/* ==========================================================================
   大富翁 · 联机版  样式表
   ========================================================================== */

:root {
  --bg: #0a1120;
  --bg-2: #101a2d;
  --panel: #17223a;
  --panel-2: #1e2b47;
  --line: #2c3a5a;
  --line-soft: #24314d;
  --text: #e9eefc;
  --muted: #94a3c4;
  --gold: #facc15;
  --gold-dark: #b45309;
  --green: #22c55e;
  --red: #ef4444;
  --blue: #3b82f6;
  --tile: clamp(38px, 5.2vw, 72px);
  --gap: 3px;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }

/* 任何带 hidden 的元素都必须真正隐藏（覆盖各处的 display:flex/grid） */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 15% -10%, #1b2b4d 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 10%, #2a1f42 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  font: 15px/1.55 "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC",
        system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 700; }
a { color: #7dd3fc; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- 顶栏 --- */

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  background: rgba(10, 17, 32, .82);
  border-bottom: 1px solid var(--line-soft);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 30;
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-logo { filter: drop-shadow(0 3px 8px rgba(250, 204, 21, .28)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 19px; letter-spacing: .06em; }
.brand-text em {
  font-style: normal;
  font-size: 11px;
  color: var(--gold);
  letter-spacing: .38em;
  text-transform: uppercase;
}

.topnav { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.conn-state {
  font-size: 12px;
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(148, 163, 196, .1);
}
.conn-state.is-bad { color: #fecaca; background: rgba(239, 68, 68, .18); }

.room-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--muted);
  padding: 5px 8px 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
}
.room-chip b {
  font-size: 17px;
  color: var(--gold);
  letter-spacing: .22em;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

/* ------------------------------------------------------------- 按钮 --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .12s ease, filter .12s ease, background .12s ease;
  white-space: nowrap;
  color: var(--text);
  background: var(--panel-2);
}
.btn:hover:not(:disabled) { filter: brightness(1.12); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(180deg, #fde047, #f59e0b);
  color: #3b2405;
  border-color: rgba(0, 0, 0, .25);
  box-shadow: 0 4px 14px rgba(245, 158, 11, .3);
}
.btn-outline { background: transparent; border-color: var(--line); color: var(--text); }
.btn-ghost { background: rgba(148, 163, 196, .1); color: var(--muted); }
.btn-build {
  background: linear-gradient(180deg, #4ade80, #16a34a);
  color: #052e16;
  border-color: rgba(0, 0, 0, .25);
}
.btn-small { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn-tiny { padding: 2px 8px; font-size: 11px; border-radius: 6px; }
.btn-block { width: 100%; }

/* ------------------------------------------------------------- 大厅 --- */

.lobby {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  padding: 18px;
  max-width: 1180px;
  margin: 0 auto;
}

.panel {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.panel-wide { grid-column: 1 / -1; }

.panel-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 16px;
  margin-bottom: 14px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line-soft);
}
.panel-title .btn { margin-left: auto; }

.form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-label { font-size: 12px; color: var(--muted); letter-spacing: .04em; }

input[type="text"], input[type="password"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0d1729;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(250, 204, 21, .16); }
input::placeholder { color: #5f6f92; }
select { cursor: pointer; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #7c8db0 50%), linear-gradient(135deg, #7c8db0 50%, transparent 50%);
  background-position: calc(100% - 17px) 18px, calc(100% - 12px) 18px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

.form-error {
  margin: 0;
  padding: 9px 12px;
  border-radius: 9px;
  background: rgba(239, 68, 68, .14);
  border: 1px solid rgba(239, 68, 68, .38);
  color: #fecaca;
  font-size: 13px;
}

/* 说明性小字：回来链接、账号找回座位之类 */
.form-hint { margin: 0; font-size: 12px; line-height: 1.7; color: var(--muted); }

.notice { padding: 10px 14px; border-radius: 10px; margin: 0 0 4px; grid-column: 1 / -1; }
.notice-warn { background: rgba(250, 204, 21, .12); border: 1px solid rgba(250, 204, 21, .3); color: #fde68a; }

/* 棋子选择器 */
.avatar-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.avatar-option { position: relative; cursor: pointer; line-height: 0; }
.avatar-option input { position: absolute; opacity: 0; pointer-events: none; }
.avatar-option img {
  border-radius: 50%;
  padding: 3px;
  border: 2px solid transparent;
  background: rgba(148, 163, 196, .1);
  transition: transform .14s ease, border-color .14s ease, background .14s ease;
}
.avatar-option:hover img { transform: translateY(-2px) scale(1.04); }
.avatar-option input:checked + img {
  border-color: var(--gold);
  background: rgba(250, 204, 21, .16);
  box-shadow: 0 0 0 3px rgba(250, 204, 21, .18);
}
.avatar-option input:focus-visible + img { outline: 2px solid #7dd3fc; outline-offset: 2px; }

/* 房间列表 */
.room-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.room-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-radius: 11px;
  background: rgba(148, 163, 196, .06);
  border: 1px solid var(--line-soft);
}
.room-code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 17px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: .18em;
}
.room-host { color: var(--muted); font-size: 13px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-count { font-size: 13px; color: var(--muted); }
.room-phase { font-size: 12px; padding: 3px 9px; border-radius: 999px; }
.room-phase.is-waiting { background: rgba(34, 197, 94, .16); color: #86efac; }
.room-phase.is-playing { background: rgba(148, 163, 196, .14); color: var(--muted); }
.room-empty { padding: 22px; text-align: center; color: var(--muted); }

.footer { text-align: center; color: #64748b; font-size: 12px; padding: 8px 18px 26px; }

/* ------------------------------------------------------------- 对局 --- */

.game-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 14px;
  padding: 12px 14px 22px;
  align-items: start;
}

.board-scroll { overflow: auto; padding: 4px; }

.board {
  display: grid;
  grid-template-columns: repeat(11, var(--tile));
  grid-template-rows: repeat(11, var(--tile));
  gap: var(--gap);
  margin: 0 auto;
  width: max-content;
  padding: 8px;
  border-radius: 18px;
  background: linear-gradient(140deg, #1c2942, #131d31);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), inset 0 0 60px rgba(0, 0, 0, .35);
}

/* 格子 -------------------------------------------------------------- */

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  overflow: hidden;
  padding: 5% 4%;
  border-radius: 6px;
  background: linear-gradient(180deg, #f8fafc, #e6ebf5);
  color: #17223a;
  font-size: calc(var(--tile) / 7.4);
  line-height: 1.16;
  text-align: center;
  box-shadow: inset 0 -1px 0 rgba(15, 23, 42, .12);
  transition: transform .12s ease, box-shadow .12s ease;
}
.tile:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 0, 0, .45); z-index: 2; }

.tile > * { position: relative; z-index: 1; }

.tile-bar {
  position: absolute !important;
  z-index: 0 !important;
  top: 0; left: 0; right: 0;
  height: 22%;
  background: var(--group, #64748b);
  border-bottom: 1px solid rgba(15, 23, 42, .25);
  border-radius: 6px 6px 0 0;
}
.tile-property { padding-top: 24%; }

/* 城市剪影水印：自绘 SVG，作为格子背景 */
.tile-logo {
  position: absolute !important;
  z-index: 0 !important;
  left: 50%;
  bottom: 1%;
  width: 88%;
  height: auto;
  transform: translateX(-50%);
  opacity: .34;
  pointer-events: none;
  transition: opacity .15s ease;
}
.tile:hover .tile-logo { opacity: .52; }
/* 水印之上压着名字和价格，给文字一点白色柔光保证清晰 */
.tile-name, .tile-price { text-shadow: 0 1px 2px rgba(255, 255, 255, .85); }

.tile.is-owned::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--owner);
  opacity: .2;
  pointer-events: none;
  z-index: -1;
}

.tile-icon { width: calc(var(--tile) * .34); height: auto; opacity: .95; }
.tile-name { font-weight: 700; letter-spacing: -.01em; }
.tile-price { font-size: .82em; color: #475569; font-variant-numeric: tabular-nums; }
.tile-price::before { content: '$'; opacity: .7; }

.tile-houses {
  display: flex;
  gap: 2px;
  align-items: center;
  justify-content: center;
  min-height: calc(var(--tile) * .09);
}
.house {
  width: calc(var(--tile) * .13);
  height: calc(var(--tile) * .085);
  background: linear-gradient(180deg, #4ade80, #15803d);
  border: 1px solid rgba(15, 23, 42, .45);
  border-radius: 2px;
}
.house.is-hotel {
  width: calc(var(--tile) * .3);
  background: linear-gradient(180deg, #f87171, #b91c1c);
}

.tile-badge {
  position: absolute !important;
  z-index: 3 !important;
  top: 2px; right: 2px;
  width: calc(var(--tile) * .36);
  height: calc(var(--tile) * .36);
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 0 0 2px var(--owner, #64748b), 0 2px 6px rgba(0, 0, 0, .4);
  line-height: 0;
}
.tile-badge img { width: 100%; height: 100%; display: block; }

/* 「＋」：轮到自己时，自己名下还能升级的地产上的提示，点开卡片即可连升 */
.tile-build {
  position: absolute !important;
  z-index: 3 !important;
  left: 2px; bottom: 2px;
  width: calc(var(--tile) * .3);
  height: calc(var(--tile) * .3);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(180deg, #fbbf24, #d97706);
  color: #3b2405;
  font-size: calc(var(--tile) * .2);
  font-style: normal;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, .5), 0 2px 6px rgba(0, 0, 0, .45);
  animation: buildPulse 1.6s ease-in-out infinite;
}
.tile-build[hidden] { display: none; }
@keyframes buildPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.14); } }
.tile.can-build { box-shadow: inset 0 -1px 0 rgba(15, 23, 42, .12), 0 0 0 2px rgba(251, 191, 36, .75); }
.tile { cursor: pointer; }
.tile:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.tile-pieces {
  position: absolute !important;
  z-index: 4 !important;
  left: 0; right: 0; bottom: 1px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  pointer-events: none;
}
.piece {
  width: 32%;
  height: auto;
  transform: translateX(calc(var(--i) * 13%));
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .5));
  transition: transform .18s ease;
}
.piece.is-current { animation: hop .75s ease-in-out infinite; z-index: 2; }
@keyframes hop {
  0%, 100% { transform: translateX(calc(var(--i) * 13%)) translateY(0); }
  50% { transform: translateX(calc(var(--i) * 13%)) translateY(-22%); }
}

/* 「我在这里」：自己的视角里，自己的棋子会发光，头顶插一枚会点头的箭头。
   箭头横向位置跟着棋子在格子里散开的位移走：
   棋子中心 = 66% - 16% * 人数 + 32% * 序号（挤开）+ 4.16% * 序号（棋子自身 translateX(13%)，
   百分比是针对棋子宽度的 32%，所以是 32% * 13%）。 */
.tile.has-me { outline: 2px solid var(--me); outline-offset: -3px; }
.tile.has-me:focus-visible { outline: 2px solid var(--gold); outline-offset: -3px; }
.piece.is-me {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .55))
          drop-shadow(0 0 3px var(--me)) drop-shadow(0 0 7px var(--me));
}
.tile-me-arrow {
  position: absolute;
  bottom: calc(100% - 3px);
  left: calc(66% - 16% * var(--n, 1) + 36.16% * var(--i, 0));
  width: calc(var(--tile) * .26);
  height: calc(var(--tile) * .24);
  transform: translateX(-50%);
  background: var(--me, var(--gold));
  -webkit-mask: url(/images/ui/arrow.svg) no-repeat center / contain;
  mask: url(/images/ui/arrow.svg) no-repeat center / contain;
  filter: drop-shadow(0 0 2px rgba(15, 23, 42, .95)) drop-shadow(0 0 5px var(--me, var(--gold)));
  animation: mePoint 1.15s ease-in-out infinite;
  pointer-events: none;
}
@keyframes mePoint {
  0%, 100% { transform: translateX(-50%) translateY(-16%); }
  50% { transform: translateX(-50%) translateY(14%); }
}

/* 角落格 */
.tile-start, .tile-jail, .tile-parking, .tile-hospital {
  background: linear-gradient(180deg, #1e293b, #0f172a);
  color: #e2e8f0;
  font-size: calc(var(--tile) / 6.4);
}
.tile-start .tile-name { color: #86efac; }
.tile-jail .tile-name { color: #fca5a5; }
.tile-parking .tile-name { color: #93c5fd; }
.tile-hospital .tile-name { color: #fda4af; }

.tile-chance { background: linear-gradient(180deg, #fff7ed, #ffedd5); }
.tile-fate { background: linear-gradient(180deg, #f5f3ff, #ede9fe); }
.tile-tax { background: linear-gradient(180deg, #fefce8, #fef3c7); }
.tile-bonus { background: linear-gradient(180deg, #fff1f2, #ffe4e6); }
.tile-station { background: linear-gradient(180deg, #f0f9ff, #e0f2fe); }

/* 棋盘中央 ---------------------------------------------------------- */

.board-center {
  grid-area: 2 / 2 / 11 / 11;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: 14px;
  background:
    radial-gradient(600px 300px at 50% 0%, rgba(250, 204, 21, .08), transparent 70%),
    linear-gradient(160deg, #16223a, #0d1729);
  border: 1px solid var(--line-soft);
  overflow: hidden;
}

.bc-head { display: flex; align-items: center; gap: 10px; }
.bc-head-text { display: flex; flex-direction: column; line-height: 1.15; }
.bc-head-text strong { font-size: 17px; letter-spacing: .05em; }
.bc-head-text span { font-size: 12px; color: var(--muted); }

.bc-turn {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(148, 163, 196, .07);
  border: 1px solid var(--line-soft);
}
.bc-turn.is-me { border-color: rgba(250, 204, 21, .55); background: rgba(250, 204, 21, .1); }
.bc-turn img { flex: none; }
.bc-turn div { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.bc-turn strong { font-size: 15px; }
.bc-turn span { font-size: 12.5px; color: var(--muted); }

.bc-dice { display: flex; justify-content: center; gap: 14px; padding: 2px 0; }
.die {
  width: clamp(40px, 5.4vw, 58px);
  height: clamp(40px, 5.4vw, 58px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 3px;
  padding: 7px;
  border-radius: 12px;
  background: linear-gradient(160deg, #ffffff, #dbe3f0);
  border: 2px solid #0f172a;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .5), inset 0 -3px 0 rgba(15, 23, 42, .18);
}
.die .pip { border-radius: 50%; background: transparent; }
.die .pip.is-on { background: #0f172a; box-shadow: inset 0 -1px 1px rgba(255, 255, 255, .35); }
.bc-dice.has-value .die { animation: pop .35s ease; }
@keyframes pop { 0% { transform: scale(.86) rotate(-6deg); } 60% { transform: scale(1.08) rotate(3deg); } 100% { transform: scale(1); } }
.die.is-rolling { animation: shake .45s ease; }
@keyframes shake {
  0%, 100% { transform: rotate(0) scale(1); }
  20% { transform: rotate(-14deg) scale(1.06); }
  40% { transform: rotate(11deg) scale(.95); }
  60% { transform: rotate(-8deg) scale(1.04); }
  80% { transform: rotate(6deg) scale(.98); }
}

.bc-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.bc-waiting { margin: 0; color: var(--muted); font-size: 13.5px; text-align: center; }

.bc-players {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}
.pcard {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 11px;
  background: rgba(148, 163, 196, .06);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--seat, #64748b);
}
.pcard.is-current { background: rgba(250, 204, 21, .12); border-color: rgba(250, 204, 21, .45); border-left-color: var(--seat); }
.pcard.is-bankrupt { opacity: .45; filter: grayscale(.7); }
.pcard.is-offline { opacity: .7; }
.pcard.is-me { box-shadow: inset 0 0 0 1px rgba(125, 211, 252, .4); }
.pcard-main { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; flex: 1; }
.pcard-name { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.pcard-money { font-size: 12px; color: #fde68a; font-variant-numeric: tabular-nums; }
.pcard-money em { font-style: normal; color: var(--muted); }
.pcard-count {
  font-size: 12px;
  color: var(--muted);
  background: rgba(148, 163, 196, .14);
  border-radius: 999px;
  padding: 2px 8px;
  min-width: 26px;
  text-align: center;
}
.pcard-pot { border-left-color: var(--gold); grid-column: 1 / -1; }
.pb { font-style: normal; font-size: 10px; padding: 1px 5px; border-radius: 999px; font-weight: 600; }
.pb-jail { background: rgba(239, 68, 68, .2); color: #fca5a5; }
.pb-hosp { background: rgba(56, 189, 248, .2); color: #7dd3fc; }
.pb-bankrupt { background: rgba(100, 116, 139, .3); color: #cbd5e1; }
.pb-off { background: rgba(148, 163, 196, .2); color: var(--muted); }

.bc-hint { margin: 0; font-size: 12px; color: #fbbf24; text-align: center; }

/* 对局区 ------------------------------------------------------------ */

.bc-play {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
  overflow: auto;
}

/* 等待大厅 ---------------------------------------------------------- */

.bc-wait { display: flex; flex-direction: column; gap: 12px; overflow: auto; }
.bc-wait h3 { font-size: 16px; }
.bc-wait-info { margin: 0; font-size: 13px; color: var(--muted); }
.seat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 9px; }
.seat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 11px 8px;
  border-radius: 12px;
  background: rgba(148, 163, 196, .06);
  border: 1px dashed var(--line);
}
.seat.is-filled { border-style: solid; background: rgba(34, 197, 94, .08); border-color: rgba(34, 197, 94, .3); }
.seat.is-me { box-shadow: inset 0 0 0 1px rgba(250, 204, 21, .55); }
.seat.is-offline { opacity: .55; }
.seat-name { font-size: 13px; font-weight: 600; }
.seat-tag { font-size: 11px; color: var(--muted); }
.seat-empty { font-size: 12px; color: #5f6f92; padding: 14px 0; }
.bc-wait-actions { display: flex; flex-direction: column; gap: 10px; margin-top: auto; }
.wait-avatar { display: flex; flex-direction: column; gap: 6px; }
.bc-wait-tip { margin: 0; font-size: 12px; color: var(--muted); text-align: center; }

/* 「回来链接」：关掉页面/换设备后，用它 + 房间密码坐回自己的位子 */
.bc-wait-link {
  align-self: flex-start;
  padding: 6px 11px;
  border-radius: 9px;
  font-size: 12px;
  color: #bfdbfe;
  background: rgba(59, 130, 246, .12);
  border: 1px dashed rgba(59, 130, 246, .45);
  cursor: pointer;
}
.bc-wait-link:hover { background: rgba(59, 130, 246, .22); }
.resume-lead {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.7;
  color: #bfdbfe;
  background: rgba(59, 130, 246, .12);
  border: 1px solid rgba(59, 130, 246, .35);
}

/* 侧栏 -------------------------------------------------------------- */

.sidepanel {
  display: flex;
  flex-direction: column;
  min-height: 420px;
  max-height: calc(100vh - 90px);
  position: sticky;
  top: 66px;
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.tabs { display: flex; border-bottom: 1px solid var(--line-soft); background: rgba(10, 17, 32, .4); }
.tab {
  flex: 1;
  padding: 11px 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  position: relative;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--gold); border-bottom-color: var(--gold); }
.tab.has-flash::after {
  content: '';
  position: absolute;
  top: 8px; right: 16px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--red);
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

.tab-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.log, .chat {
  list-style: none;
  margin: 0;
  padding: 10px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  scrollbar-width: thin;
}
.log-item { display: flex; gap: 7px; padding: 5px 8px; border-radius: 8px; background: rgba(148, 163, 196, .05); }
.log-turn {
  flex: none;
  font-size: 11px;
  color: #64748b;
  font-variant-numeric: tabular-nums;
  padding-top: 2px;
  min-width: 16px;
}
.log-text { flex: 1; min-width: 0; word-break: break-word; }
.log-good .log-text { color: #86efac; }
.log-bad .log-text { color: #fca5a5; }
.log-warn .log-text { color: #fcd34d; }
.log-roll .log-text { color: #93c5fd; }
.log-win .log-text { color: var(--gold); font-weight: 700; }
.log-system .log-text { color: #a5b4fc; }

.chat-item { padding: 5px 8px; border-radius: 8px; background: rgba(148, 163, 196, .05); word-break: break-word; }
.chat-from { color: #7dd3fc; font-weight: 600; margin-right: 6px; font-size: 12px; }
.chat-item.is-system { background: transparent; color: var(--muted); font-size: 12px; text-align: center; }

.chat-form { display: flex; gap: 7px; padding: 9px; border-top: 1px solid var(--line-soft); }
.chat-form input { flex: 1; }

.me-panel { padding: 12px; overflow-y: auto; flex: 1; font-size: 13px; }
.me-head { display: flex; align-items: center; gap: 11px; margin-bottom: 10px; }
.me-head div { display: flex; flex-direction: column; line-height: 1.3; }
.me-head span { font-size: 12px; color: var(--muted); }
.me-stats { display: flex; gap: 8px; margin-bottom: 10px; }
.me-stats span {
  flex: 1;
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(148, 163, 196, .07);
  font-size: 12px;
  color: var(--muted);
}
.me-stats b { color: var(--text); font-size: 15px; display: block; }
/* 「你在第几格」：和棋盘上的箭头同一枚图形，方便对上 */
.me-locate {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 10px;
  padding: 7px 10px;
  border-radius: 9px;
  border: 1px solid rgba(148, 163, 196, .22);
  background: rgba(148, 163, 196, .07);
  font-size: 12.5px;
  color: var(--text);
}
.me-locate-arrow {
  flex: none;
  width: 15px;
  height: 15px;
  background: var(--me, var(--gold));
  -webkit-mask: url(/images/ui/arrow.svg) no-repeat center / contain;
  mask: url(/images/ui/arrow.svg) no-repeat center / contain;
  animation: mePointSmall 1.15s ease-in-out infinite;
}
@keyframes mePointSmall { 0%, 100% { transform: translateY(-8%); } 50% { transform: translateY(8%); } }
.me-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.me-list li { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 9px; background: rgba(148, 163, 196, .06); }
.me-color { width: 5px; height: 30px; border-radius: 3px; flex: none; }
.me-li-main { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.me-li-main span { font-size: 11.5px; color: var(--muted); }
.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 18px 6px; }

/* ------------------------------------------------------- 弹窗 / 提示 --- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 18, .72);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 60;
}
.overlay[hidden] { display: none; }

.dialog {
  width: min(440px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 22px;
  border-radius: 18px;
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
  animation: rise .2s ease;
}
@keyframes rise { from { transform: translateY(14px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }

.dialog-title { display: flex; align-items: center; gap: 9px; font-size: 18px; margin-bottom: 15px; }
.dialog-title b { color: var(--gold); letter-spacing: .16em; font-family: ui-monospace, Consolas, monospace; }
.dialog-sub { margin: -8px 0 12px; color: var(--muted); font-size: 13px; }
.dialog-actions { display: flex; gap: 9px; margin-top: 16px; }
.dialog-actions .btn { flex: 1; }

.dialog-card { text-align: center; width: min(400px, 100%); }
.card-kind {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .18em;
  padding: 5px 14px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.card-chance .card-kind { background: rgba(249, 115, 22, .2); color: #fdba74; }
.card-fate .card-kind { background: rgba(168, 85, 247, .2); color: #d8b4fe; }
.card-title { font-size: 21px; margin-bottom: 9px; }
.card-text { margin: 0 0 18px; color: #cbd5e1; font-size: 14.5px; line-height: 1.65; }

/* ---------------------------------------------- 城市卡片（点格子打开） --- */

.dialog-tile {
  width: min(520px, 100%);
  max-height: min(92vh, 860px);
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tc-head {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 14px;
  padding: 16px 18px 14px;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, .05), rgba(15, 23, 42, .62)),
    linear-gradient(135deg, var(--group, #475569), rgba(15, 23, 42, .9));
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.tc-logo {
  position: absolute;
  right: -6px;
  bottom: -8px;
  width: 46%;
  height: auto;
  opacity: .3;
  pointer-events: none;
}
.tc-head-text { position: relative; min-width: 0; }
.tc-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  color: #e8eefc;
  background: rgba(4, 8, 18, .45);
  border: 1px solid rgba(255, 255, 255, .18);
  padding: 3px 10px;
  border-radius: 999px;
}
.tc-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--group, #94a3b8); box-shadow: 0 0 0 2px rgba(4, 8, 18, .5); }
.tc-title { margin: 7px 0 2px; font-size: 24px; line-height: 1.1; text-shadow: 0 2px 8px rgba(4, 8, 18, .65); }
.tc-sub { font-size: 13px; color: #e2e8f5; text-shadow: 0 1px 4px rgba(4, 8, 18, .7); }
.tc-close {
  position: absolute;
  top: 10px; right: 10px;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(4, 8, 18, .5);
  color: #f1f5f9;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.tc-close:hover { background: rgba(4, 8, 18, .78); }

.tc-body { padding: 15px 18px 16px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }

.tc-footbar {
  flex: 0 0 auto;
  padding: 12px 18px 15px;
  border-top: 1px solid var(--line);
  background: rgba(4, 8, 18, .38);
}
.tc-footbar .tc-note { margin-bottom: 8px; }
.tc-footbar .tc-foot { margin-bottom: 0; }

.tc-rows { margin: 0 0 12px; display: flex; flex-direction: column; gap: 1px; }
.tc-rows > div {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  padding: 9px 11px;
  background: rgba(148, 163, 196, .07);
  border-radius: 9px;
}
.tc-rows dt { color: var(--muted); font-size: 13px; flex: 0 0 auto; }
.tc-rows dd {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  font-size: 14.5px;
  text-align: right;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.tc-rows dd.tc-rent { color: #fcd34d; font-size: 16px; }
.tc-dim { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.tc-you {
  font-style: normal;
  font-size: 11px;
  font-weight: 800;
  color: #052e16;
  background: #86efac;
  border-radius: 999px;
  padding: 1px 7px;
}
.tc-piece { border-radius: 50%; background: rgba(255, 255, 255, .12); }

.tc-rents { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.tc-rent-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 11px;
  border-radius: 8px;
  background: rgba(148, 163, 196, .06);
  font-size: 13.5px;
  color: #cbd5e1;
}
.tc-rent-row span { flex: 1; }
.tc-rent-row b { color: #fde68a; font-variant-numeric: tabular-nums; }
.tc-rent-row em {
  font-style: normal;
  font-size: 11px;
  font-weight: 800;
  color: #052e16;
  background: var(--gold);
  border-radius: 999px;
  padding: 1px 8px;
}
.tc-rent-row.is-now { background: rgba(250, 204, 21, .16); box-shadow: inset 0 0 0 1px rgba(250, 204, 21, .45); }

.tc-note { margin: 0 0 10px; font-size: 12.5px; line-height: 1.7; color: var(--muted); }
.tc-here { margin: 0 0 10px; font-size: 13px; color: #cbd5e1; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tc-here img { vertical-align: -4px; margin-left: 4px; }
.tc-tip {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(56, 189, 248, .12);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, .3);
  font-size: 13px;
  line-height: 1.6;
  color: #dbeafe;
}
.tc-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.tc-actions .btn { justify-content: center; }
.tc-actions .btn:disabled { opacity: .45; cursor: not-allowed; }
.tc-foot { margin: 12px 0 0; font-size: 11.5px; color: var(--muted); text-align: center; }

@media (max-width: 900px) {
  .dialog-tile { width: 100%; max-height: 94vh; }
  .tc-body { padding: 13px 14px 14px; }
  .tc-title { font-size: 21px; }
  .tc-head { padding: 13px 14px 12px; }
  .tc-footbar { padding: 11px 14px 13px; }
  .tc-rent-row { padding: 6px 10px; font-size: 13px; }
}

.rank { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rank li { display: flex; align-items: center; gap: 9px; padding: 8px 11px; border-radius: 10px; background: rgba(148, 163, 196, .07); }
.rank li.is-winner { background: rgba(250, 204, 21, .16); box-shadow: inset 0 0 0 1px rgba(250, 204, 21, .45); }
.rank-no { width: 20px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.rank-name { flex: 1; min-width: 0; }
.rank-money { font-variant-numeric: tabular-nums; color: #fde68a; font-size: 13px; }

.toast-host {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  z-index: 90;
  pointer-events: none;
}
.toast {
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  background: linear-gradient(180deg, #fca5a5, #dc2626);
  color: #fff;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .5);
  animation: toastIn .2s ease;
}
.toast-ok { background: linear-gradient(180deg, #86efac, #16a34a); color: #052e16; }
.toast-warn { background: linear-gradient(180deg, #fcd34d, #d97706); color: #3b2405; }
.toast.is-out { opacity: 0; transform: translateY(8px); transition: opacity .4s ease, transform .4s ease; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------ 规则页 --- */

.rules { max-width: 1100px; }
.rules p { margin: 9px 0; }
.muted { color: var(--muted); font-size: 13.5px; }

.rule-list { margin: 6px 0; padding-left: 20px; display: flex; flex-direction: column; gap: 7px; }
.rule-list li { padding-left: 2px; }
.rule-list strong { color: var(--gold); }

.rule-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.rule-group {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(148, 163, 196, .05);
  border: 1px solid var(--line-soft);
  border-top: 3px solid var(--group, #64748b);
}
.rule-group h3 { display: flex; align-items: center; gap: 8px; font-size: 15px; margin-bottom: 8px; }
.rule-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--group); flex: none; }

/* 城市图鉴（规则页） */
.city-atlas { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; margin-top: 10px; }
.city-card {
  margin: 0;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(148, 163, 196, .05);
  border: 1px solid var(--line-soft);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .3);
  transition: transform .12s ease, box-shadow .12s ease;
}
.city-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0, 0, 0, .45); }
.city-card img { display: block; width: 100%; height: auto; background: linear-gradient(180deg, #f8fafc, #e6ebf5); }
.city-card figcaption {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 9px 8px;
  border-top: 3px solid var(--group, #64748b);
}
.city-card strong { font-size: 14px; color: #e8eefc; }
.city-card span { font-size: 11.5px; color: #9fb0cc; font-variant-numeric: tabular-nums; }

.rule-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.rule-table th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
}
.rule-table td { padding: 5px 8px; border-bottom: 1px solid rgba(44, 58, 90, .5); }
.rule-table tr:last-child td { border-bottom: 0; }
.rule-table tbody tr:hover { background: rgba(148, 163, 196, .06); }

.card-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 420px; overflow-y: auto; }
.card-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 11px;
  border-radius: 9px;
  background: rgba(148, 163, 196, .06);
  border-left: 3px solid var(--line);
  font-size: 13px;
}
.card-item strong { font-size: 13.5px; }
.card-item span { color: var(--muted); font-size: 12.5px; }
.card-good { border-left-color: #f97316; }
.card-good strong { color: #fdba74; }
.card-bad { border-left-color: #a855f7; }
.card-bad strong { color: #d8b4fe; }

code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: .92em;
  background: rgba(148, 163, 196, .14);
  padding: 1px 6px;
  border-radius: 5px;
}

/* ------------------------------------------------- 账号 / 排行榜 --- */

.inline-form { display: inline-flex; margin: 0; }
.topnav-user {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(59, 130, 246, .14);
  border: 1px solid rgba(59, 130, 246, .32);
  font-size: 13px;
  max-width: 12em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-card { grid-column: 1 / -1; max-width: 460px; width: 100%; margin: 0 auto; }
.auth-alt { margin-top: 14px; text-align: center; }
.auth-alt a { color: #93c5fd; }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }

.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 13px;
  border-radius: 12px;
  background: rgba(148, 163, 196, .06);
  border: 1px solid var(--line-soft);
}
.stat-label { font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.stat-value { font-size: 20px; font-variant-numeric: tabular-nums; }
.stat-card-wide { grid-column: span 2; }

.table-wrap { width: 100%; overflow-x: auto; }

.data-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.data-table th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table td { padding: 7px 9px; border-bottom: 1px solid rgba(44, 58, 90, .5); }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: rgba(148, 163, 196, .06); }
.data-table tr.is-me { background: rgba(250, 204, 21, .1); }
.data-table .num { text-align: right; }
.rank-cell { font-weight: 700; }
.tag {
  display: inline-block;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(250, 204, 21, .2);
  color: #fde68a;
  font-size: 11px;
}

.recent-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.recent-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 8px 11px;
  border-radius: 10px;
  background: rgba(148, 163, 196, .07);
  font-size: 13px;
}
.recent-code {
  font-family: ui-monospace, Consolas, monospace;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--gold);
}

/* --------------------------------------------------------- 响应式 --- */

@media (max-width: 1180px) {
  .game-grid { grid-template-columns: minmax(0, 1fr); }
  .sidepanel { position: static; max-height: 460px; }
}

@media (max-width: 900px) {
  :root { --tile: clamp(34px, 8.2vw, 62px); }
  /* 格子变小后城市剪影的细节会糊在一起，压淡一点更干净 */
  .tile-logo { opacity: .3; }
  .lobby { grid-template-columns: minmax(0, 1fr); padding: 12px; }
  .field-row { grid-template-columns: 1fr; }
  .board-center { padding: 10px; gap: 7px; }
  .bc-players { grid-template-columns: 1fr; }
  .brand-text em { display: none; }
  .room-host { display: none; }
}

@media (max-width: 560px) {
  .tile-name { font-size: .8em; }
  .tile-price { display: none; }
  .topbar { padding: 8px 10px; gap: 8px; }
  .room-chip span { display: none; }
}
