/* ============================================================
   文明放置 2 · 联机版  ——  深色文明主题
   金色 = 文明/王权；深蓝黑 = 夜空/战略地图
   ============================================================ */

:root {
  --gold:        #d4a24a;
  --gold-lt:     #f0cf8a;
  --gold-dk:     #9b7226;
  --bg-0:        #0a0c14;
  --bg-1:        #11141f;
  --bg-2:        #171b2a;
  --bg-3:        #1e2333;
  --line:        #2a3145;
  --line-lt:     #3a4460;
  --txt:         #e6e3da;
  --txt-dim:     #97a0b8;
  --txt-mute:    #626b82;
  --green:       #4ea86b;
  --red:         #d8564f;
  --blue:        #4a8fd4;
  --purple:      #9a6fd4;
  --amber:       #e0a63c;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 8px 32px rgba(0,0,0,.55);
  --shadow-sm: 0 2px 10px rgba(0,0,0,.4);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg-0);
  color: var(--txt);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

body.starry {
  background-image:
    radial-gradient(1px 1px at 12% 18%, rgba(255,255,255,.5), transparent),
    radial-gradient(1px 1px at 78% 8%,  rgba(255,255,255,.35), transparent),
    radial-gradient(1.5px 1.5px at 45% 62%, rgba(212,162,74,.35), transparent),
    radial-gradient(1px 1px at 88% 74%, rgba(255,255,255,.3), transparent),
    radial-gradient(1px 1px at 25% 88%, rgba(255,255,255,.25), transparent),
    linear-gradient(160deg, #0a0c14 0%, #0d1120 45%, #101425 100%);
}

a { color: var(--gold-lt); text-decoration: none; }
a:hover { color: var(--gold); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb { background: var(--line-lt); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dk); }

/* ==================== 通用组件 ==================== */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 20px; border: 1px solid var(--line-lt); border-radius: var(--radius-sm);
  background: var(--bg-3); color: var(--txt);
  font-family: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: #262c40; border-color: var(--gold-dk); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-gold {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dk) 100%);
  border-color: var(--gold-lt); color: #1a1408; font-weight: 700;
  box-shadow: 0 3px 14px rgba(212,162,74,.35);
}
.btn-gold:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--gold-lt) 0%, var(--gold) 100%);
  box-shadow: 0 5px 20px rgba(212,162,74,.55);
}

.btn-danger { border-color: #6b2e2a; color: #f0a49e; }
.btn-danger:hover:not(:disabled) { background: #3a1f1d; border-color: var(--red); }

.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.btn-block { width: 100%; }

.input {
  width: 100%; padding: 10px 13px;
  background: var(--bg-0); border: 1px solid var(--line);
  border-radius: var(--radius-sm); color: var(--txt);
  font-family: inherit; font-size: 14px; transition: border-color .15s;
}
.input:focus { outline: none; border-color: var(--gold-dk); box-shadow: 0 0 0 3px rgba(212,162,74,.12); }
.input::placeholder { color: var(--txt-mute); }

select.input { cursor: pointer; }
select.input option { background: var(--bg-2); }

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

.tag {
  display: inline-block; padding: 1px 8px; border-radius: 10px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .3px;
}
.tag-wait { background: rgba(224,166,60,.16); color: var(--amber); border: 1px solid rgba(224,166,60,.3); }
.tag-play { background: rgba(78,168,107,.16); color: var(--green); border: 1px solid rgba(78,168,107,.3); }
.tag-host { background: rgba(212,162,74,.16); color: var(--gold-lt); border: 1px solid rgba(212,162,74,.35); }

.muted { color: var(--txt-mute); }
.dim { color: var(--txt-dim); }
.mono { font-family: var(--mono); }

.sec-title {
  font-size: 12px; font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--txt-mute);
  padding: 0 2px 8px; border-bottom: 1px solid var(--line); margin-bottom: 10px;
}

/* ==================== 认证页 ==================== */

.auth-wrap {
  height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px; overflow-y: auto;
}
.auth-box {
  width: 100%; max-width: 400px;
  background: linear-gradient(170deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--line-lt); border-radius: 16px;
  padding: 34px 30px 28px; box-shadow: var(--shadow);
  position: relative;
}
.auth-box::before {
  content: ''; position: absolute; inset: -1px; border-radius: 16px;
  background: linear-gradient(140deg, rgba(212,162,74,.4), transparent 40%, transparent 60%, rgba(212,162,74,.18));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none;
}
.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-logo .emblem {
  font-size: 46px; line-height: 1; margin-bottom: 10px;
  filter: drop-shadow(0 3px 12px rgba(212,162,74,.5));
}
.auth-logo h1 {
  font-size: 25px; font-weight: 700; letter-spacing: 3px;
  background: linear-gradient(135deg, var(--gold-lt), var(--gold), var(--gold-dk));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.auth-logo p { font-size: 12px; letter-spacing: 1px; color: var(--txt-mute); margin-top: 5px; }

.auth-tabs {
  display: flex; gap: 4px; margin-bottom: 20px;
  background: var(--bg-0); padding: 4px; border-radius: 8px;
}
.auth-tabs button {
  flex: 1; padding: 8px; border: none; border-radius: 6px;
  background: transparent; color: var(--txt-dim);
  font-family: inherit; font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.auth-tabs button.on {
  background: var(--bg-3); color: var(--gold-lt);
  box-shadow: var(--shadow-sm);
}
.auth-field { margin-bottom: 14px; }
.auth-field label {
  display: block; font-size: 12px; color: var(--txt-mute);
  margin-bottom: 5px; letter-spacing: .5px;
}
.auth-msg {
  min-height: 18px; font-size: 12.5px; margin: 4px 0 10px;
  color: var(--red); text-align: center;
}
.auth-msg.ok { color: var(--green); }
.auth-foot { text-align: center; margin-top: 18px; font-size: 12.5px; color: var(--txt-mute); }
.auth-foot a { color: var(--gold); }

/* ==================== 大厅 ==================== */

.app { height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px; height: 56px; flex: 0 0 56px;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 12px rgba(0,0,0,.35);
  z-index: 50;
}
.topbar .brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 16px; letter-spacing: 1.5px;
  background: linear-gradient(135deg, var(--gold-lt), var(--gold));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.topbar .spacer { flex: 1; }
.topbar .who {
  display: flex; align-items: center; gap: 9px;
  font-size: 13px; color: var(--txt-dim);
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-dk), var(--gold));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #1a1408; flex: 0 0 30px;
}
.dot {
  width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px;
  background: var(--red); box-shadow: 0 0 8px currentColor;
}
.dot.on { background: var(--green); color: var(--green); }

.lobby-body { flex: 1; display: flex; overflow: hidden; }

.lobby-main { flex: 1; padding: 22px 24px; overflow-y: auto; }
.lobby-side {
  width: 330px; flex: 0 0 330px; padding: 22px 20px;
  background: var(--bg-1); border-left: 1px solid var(--line);
  overflow-y: auto;
}

.page-head {
  display: flex; align-items: center; gap: 12px; margin-bottom: 18px;
}
.page-head h2 {
  font-size: 19px; font-weight: 700; letter-spacing: .5px;
  display: flex; align-items: center; gap: 9px;
}
.page-head .spacer { flex: 1; }

.room-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
}
.room-card {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px 16px;
  cursor: pointer; transition: all .18s; position: relative; overflow: hidden;
}
.room-card::after {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--gold), var(--gold-dk));
  opacity: 0; transition: opacity .18s;
}
.room-card:hover {
  border-color: var(--gold-dk); transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(0,0,0,.5);
}
.room-card:hover::after { opacity: 1; }
.room-card .rc-top {
  display: flex; align-items: flex-start; gap: 8px; margin-bottom: 9px;
}
.room-card .rc-name {
  font-weight: 600; font-size: 15px; flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.room-card .rc-meta {
  display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--txt-mute);
}
.room-card .rc-players { display: flex; gap: 3px; margin-top: 10px; }
.seat-pip {
  width: 24px; height: 5px; border-radius: 3px; background: var(--line);
}
.seat-pip.on { background: linear-gradient(90deg, var(--gold), var(--gold-dk)); }
.seat-pip.ai { background: linear-gradient(90deg, #4a86c8, #2f5c94); }

.empty-box {
  text-align: center; padding: 60px 20px; color: var(--txt-mute);
}
.empty-box .big { font-size: 44px; margin-bottom: 14px; opacity: .5; }
.empty-box p { font-size: 13.5px; }

.side-block { margin-bottom: 26px; }
.side-block .row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0; font-size: 13px;
}
.side-block .row + .row { border-top: 1px solid var(--line); }
.side-block .row .k { color: var(--txt-mute); }
.side-block .row .v { color: var(--txt); font-weight: 500; }

.tips { font-size: 12.5px; color: var(--txt-mute); line-height: 1.75; }
.tips li { margin-left: 16px; margin-bottom: 5px; }

/* ==================== 房间等待页 ==================== */

.room-body {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 26px; overflow-y: auto;
}
.room-panel {
  width: 100%; max-width: 680px;
  background: linear-gradient(170deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--line-lt); border-radius: 14px;
  padding: 26px; box-shadow: var(--shadow);
}
.room-head {
  display: flex; align-items: center; gap: 12px; margin-bottom: 6px;
}
.room-head h2 { font-size: 21px; font-weight: 700; flex: 1; }
.room-sub { font-size: 12.5px; color: var(--txt-mute); margin-bottom: 20px; }

.seat-list { display: grid; gap: 10px; margin-bottom: 22px; }
.seat {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 15px; border-radius: var(--radius);
  background: var(--bg-0); border: 1px solid var(--line);
  transition: all .18s;
}
.seat.mine { border-color: var(--gold-dk); background: rgba(212,162,74,.06); }
.seat.empty { opacity: .45; border-style: dashed; }
/* 机器人席位：不透明、蓝色描边，与「等玩家」的空位区分开 */
.seat.empty.ai-seat {
  opacity: .85;
  border-style: dashed;
  border-color: rgba(74,134,200,.5);
  background: rgba(74,134,200,.05);
}
.seat.empty.ai-seat .seat-no {
  background: rgba(74,134,200,.16);
  border-color: rgba(74,134,200,.45);
  color: #7fb0e0;
}
.seat.empty.ai-seat .seat-civ { color: #7fb0e0; }
.seat .seat-no {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%;
  background: var(--bg-3); border: 1px solid var(--line-lt);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--txt-dim);
}
.seat.mine .seat-no { background: var(--gold-dk); color: #1a1408; border-color: var(--gold-lt); }
.seat .seat-info { flex: 1; min-width: 0; }
.seat .seat-name {
  font-weight: 600; font-size: 14.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.seat .seat-civ { font-size: 12px; color: var(--txt-mute); margin-top: 1px; }
.seat .seat-ready {
  font-size: 12px; font-weight: 700; letter-spacing: .5px;
  padding: 3px 10px; border-radius: 10px;
}
.seat .seat-ready.yes { background: rgba(78,168,107,.16); color: var(--green); }
.seat .seat-ready.no  { background: rgba(151,160,184,.1); color: var(--txt-mute); }

.room-actions {
  display: flex; align-items: center; gap: 10px;
  padding-top: 18px; border-top: 1px solid var(--line);
}
.room-actions .spacer { flex: 1; }

/* ==================== 游戏主界面 ==================== */

.game {
  height: 100vh; display: flex; flex-direction: column;
  background: var(--bg-0);
}

/* 顶部资源条 */
.hud-top {
  display: flex; align-items: center; gap: 6px;
  height: 52px; flex: 0 0 52px; padding: 0 14px;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border-bottom: 1px solid var(--line); z-index: 40;
}
.res {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 8px;
  background: var(--bg-0); border: 1px solid var(--line);
  font-size: 13px; white-space: nowrap;
}
.res .ico { font-size: 15px; line-height: 1; }
.res .val { font-weight: 700; font-family: var(--mono); color: var(--txt); }
.res .lbl { font-size: 11px; color: var(--txt-mute); }
.res.gold  .ico { filter: drop-shadow(0 0 5px rgba(224,166,60,.6)); }
.hud-top .spacer { flex: 1; }

.civ-badge {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 13px; border-radius: 8px;
  background: linear-gradient(135deg, rgba(212,162,74,.14), rgba(212,162,74,.05));
  border: 1px solid rgba(212,162,74,.3);
  font-size: 13px; font-weight: 600; color: var(--gold-lt);
}
.tick-badge {
  font-family: var(--mono); font-size: 12px; color: var(--txt-mute);
  padding: 5px 10px; border-radius: 8px; background: var(--bg-0);
  border: 1px solid var(--line);
}

/* 中部：左城市列表 / 中地图 / 右面板 */
.game-body { flex: 1; display: flex; overflow: hidden; }

.city-rail {
  width: 210px; flex: 0 0 210px;
  background: var(--bg-1); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; overflow: hidden;
}
.city-rail .rail-head {
  padding: 10px 13px; font-size: 11.5px; font-weight: 700;
  letter-spacing: 1.2px; text-transform: uppercase; color: var(--txt-mute);
  border-bottom: 1px solid var(--line);
}
.city-list { flex: 1; overflow-y: auto; padding: 7px; }
.city-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  cursor: pointer; transition: all .14s; margin-bottom: 3px;
}
.city-item:hover { background: var(--bg-3); }
.city-item.on {
  background: linear-gradient(90deg, rgba(212,162,74,.16), transparent);
  border-left: 2px solid var(--gold);
}
.city-item .ci-ico { font-size: 16px; flex: 0 0 18px; text-align: center; }
.city-item .ci-info { flex: 1; min-width: 0; }
.city-item .ci-name {
  font-size: 13.5px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.city-item .ci-sub { font-size: 11px; color: var(--txt-mute); }
.city-item .ci-pop {
  font-size: 11px; font-family: var(--mono); color: var(--amber);
  background: rgba(224,166,60,.1); padding: 1px 6px; border-radius: 8px;
}

/* 地图区 */
.map-area {
  flex: 1; position: relative; overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(30,40,70,.5), transparent 70%),
    var(--bg-0);
  display: flex; align-items: center; justify-content: center;
}
.map-scroll {
  position: absolute; inset: 0; overflow: auto;
  display: flex; align-items: center; justify-content: center;
  padding: 26px;
}
.map-canvas-wrap { position: relative; }
canvas.map-canvas {
  display: block; border-radius: 8px;
  border: 1px solid var(--line-lt);
  box-shadow: 0 0 0 1px rgba(0,0,0,.5), 0 14px 44px rgba(0,0,0,.6);
  image-rendering: pixelated;
  cursor: crosshair;
}

.map-legend {
  position: absolute; left: 12px; bottom: 12px; z-index: 10;
  display: flex; gap: 10px; flex-wrap: wrap;
  padding: 7px 11px; border-radius: 8px;
  background: rgba(10,12,20,.82); backdrop-filter: blur(6px);
  border: 1px solid var(--line); font-size: 11.5px;
}
.map-legend span { display: flex; align-items: center; gap: 5px; color: var(--txt-dim); }
.map-legend i {
  width: 9px; height: 9px; border-radius: 2px; display: inline-block;
}

.map-tools {
  position: absolute; right: 12px; top: 12px; z-index: 10;
  display: flex; flex-direction: column; gap: 6px;
}
.map-tools button {
  width: 32px; height: 32px; border-radius: 7px;
  background: rgba(23,27,42,.9); backdrop-filter: blur(6px);
  border: 1px solid var(--line-lt); color: var(--txt-dim);
  font-size: 15px; cursor: pointer; transition: all .14s;
  display: flex; align-items: center; justify-content: center;
}
.map-tools button:hover { border-color: var(--gold-dk); color: var(--gold-lt); }

/* 右侧面板 */
.side-panel {
  width: 330px; flex: 0 0 330px;
  background: var(--bg-1); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; overflow: hidden;
}
.panel-tabs {
  display: flex; border-bottom: 1px solid var(--line); flex: 0 0 auto;
  background: var(--bg-2);
}
.panel-tabs button {
  flex: 1; padding: 11px 6px; border: none; background: transparent;
  color: var(--txt-mute); font-family: inherit; font-size: 12.5px;
  font-weight: 600; cursor: pointer; transition: all .14s;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.panel-tabs button:hover { color: var(--txt-dim); }
.panel-tabs button.on {
  color: var(--gold-lt); border-bottom-color: var(--gold);
  background: rgba(212,162,74,.05);
}
.panel-scroll { flex: 1; overflow-y: auto; padding: 14px; }

/* 城市详情 */
.city-hd {
  display: flex; align-items: center; gap: 10px; margin-bottom: 4px;
}
.city-hd .ico { font-size: 22px; }
.city-hd h3 { font-size: 17px; font-weight: 700; flex: 1; }
.city-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 12px 0 16px;
}
.stat {
  padding: 8px 11px; border-radius: var(--radius-sm);
  background: var(--bg-0); border: 1px solid var(--line);
}
.stat .s-k { font-size: 10.5px; color: var(--txt-mute); letter-spacing: .4px; }
.stat .s-v {
  font-size: 16px; font-weight: 700; font-family: var(--mono);
  color: var(--gold-lt); margin-top: 1px;
}

.sub-tabs {
  display: flex; gap: 4px; margin-bottom: 12px;
  background: var(--bg-0); padding: 3px; border-radius: 7px;
}
.sub-tabs button {
  flex: 1; padding: 6px 4px; border: none; border-radius: 5px;
  background: transparent; color: var(--txt-mute);
  font-family: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all .14s;
}
.sub-tabs button.on { background: var(--bg-3); color: var(--gold-lt); }

.item-list { display: grid; gap: 6px; }
.item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  background: var(--bg-2); border: 1px solid var(--line);
  transition: all .14s;
}
.item:hover { border-color: var(--line-lt); }
.item.done { opacity: .55; }
.item.can { border-color: rgba(212,162,74,.35); }
.item .it-ico { font-size: 17px; flex: 0 0 20px; text-align: center; }
.item .it-info { flex: 1; min-width: 0; }
.item .it-name {
  font-size: 13px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.item .it-sub { font-size: 11px; color: var(--txt-mute); }
.item .it-cost {
  font-size: 11.5px; font-family: var(--mono); color: var(--amber);
  white-space: nowrap; font-weight: 600;
}
.item .it-act { flex: 0 0 auto; }

.prog {
  height: 4px; border-radius: 2px; background: var(--line);
  overflow: hidden; margin-top: 5px;
}
.prog > i {
  display: block; height: 100%; border-radius: 2px;
  background: linear-gradient(90deg, var(--gold-dk), var(--gold));
  transition: width .3s;
}

.citizen-row {
  display: flex; align-items: center; gap: 8px; padding: 7px 0;
  border-bottom: 1px solid var(--line);
}
.citizen-row .ck { flex: 1; font-size: 13px; }
.citizen-row .cnum {
  width: 46px; text-align: center; font-family: var(--mono);
  font-weight: 700; font-size: 14px; color: var(--gold-lt);
}
.stepper { display: flex; gap: 3px; }
.stepper button {
  width: 24px; height: 24px; border-radius: 5px;
  background: var(--bg-3); border: 1px solid var(--line-lt);
  color: var(--txt); font-size: 14px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.stepper button:hover { border-color: var(--gold-dk); color: var(--gold-lt); }

/* 外交 / 排行 */
.other-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 11px; border-radius: var(--radius-sm);
  background: var(--bg-2); border: 1px solid var(--line); margin-bottom: 6px;
}
.other-row .or-ico { font-size: 17px; flex: 0 0 20px; text-align: center; }
.other-row .or-info { flex: 1; min-width: 0; }
.other-row .or-name {
  font-size: 13px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.other-row .or-sub { font-size: 11px; color: var(--txt-mute); }
.rel-peace { color: var(--green); }
.rel-war   { color: var(--red); }
.rel-neutral { color: var(--txt-mute); }

.rank-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  background: var(--bg-2); border: 1px solid var(--line); margin-bottom: 5px;
}
.rank-row.me { border-color: var(--gold-dk); background: rgba(212,162,74,.07); }
.rank-no {
  width: 22px; height: 22px; flex: 0 0 22px; border-radius: 50%;
  background: var(--bg-3); display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700; color: var(--txt-dim);
}
.rank-row.me .rank-no { background: var(--gold-dk); color: #1a1408; }
.rank-name { flex: 1; font-size: 13px; }
.rank-score { font-family: var(--mono); font-weight: 700; color: var(--gold-lt); font-size: 13px; }

/* 战报 */
.report-row {
  padding: 10px 11px; border-radius: var(--radius-sm);
  background: var(--bg-2); border: 1px solid var(--line); margin-bottom: 6px;
  border-left: 3px solid var(--line-lt);
}
.report-row.attack { border-left-color: var(--red); }
.report-row.defense { border-left-color: var(--blue); }
.report-row.diplomacy { border-left-color: var(--purple); }
.report-row .rp-time { font-size: 11px; color: var(--txt-mute); font-family: var(--mono); }
.report-row .rp-text { font-size: 13px; margin-top: 3px; }

/* 聊天 */
.chat-area {
  display: flex; flex-direction: column; height: 100%;
}
.chat-log {
  flex: 1; overflow-y: auto; padding: 10px 12px;
  font-size: 13px; line-height: 1.6;
}
.chat-line { margin-bottom: 5px; word-break: break-word; }
.chat-line .cn { color: var(--gold-lt); font-weight: 600; }
.chat-line .ct { color: var(--txt); }
.chat-line.sys .ct { color: var(--txt-mute); font-style: italic; }
.chat-input {
  display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line);
}
.chat-input input {
  flex: 1; padding: 8px 11px; background: var(--bg-0);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--txt); font-family: inherit; font-size: 13px;
}
.chat-input input:focus { outline: none; border-color: var(--gold-dk); }

/* 弹窗 / 提示 */
.toast-wrap {
  position: fixed; top: 66px; left: 50%; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
  align-items: center; pointer-events: none;
}
.toast {
  padding: 10px 20px; border-radius: 9px; font-size: 13.5px; font-weight: 500;
  background: rgba(23,27,42,.96); backdrop-filter: blur(8px);
  border: 1px solid var(--line-lt); box-shadow: var(--shadow);
  animation: toastIn .25s ease-out; max-width: 460px;
}
.toast.err { border-color: #6b2e2a; color: #f0a49e; }
.toast.ok  { border-color: #2e6b45; color: #9ee0b5; }
.toast.info { border-color: var(--gold-dk); color: var(--gold-lt); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 结算 */
.overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(5,7,12,.86); backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.result-box {
  width: 100%; max-width: 460px;
  background: linear-gradient(170deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--gold-dk); border-radius: 15px;
  padding: 30px; box-shadow: var(--shadow); text-align: center;
}
.result-box .crown { font-size: 52px; margin-bottom: 10px; }
.result-box h2 { font-size: 24px; margin-bottom: 6px; color: var(--gold-lt); }
.result-box p { color: var(--txt-dim); font-size: 13.5px; margin-bottom: 20px; }
.result-board { text-align: left; margin-bottom: 22px; }

/* 加载 */
.loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100vh; gap: 18px;
}
.spinner {
  width: 42px; height: 42px; border: 3px solid var(--line);
  border-top-color: var(--gold); border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading p { color: var(--txt-mute); font-size: 13.5px; letter-spacing: .5px; }

/* 移动端 */
@media (max-width: 1080px) {
  .lobby-side { display: none; }
  .side-panel { width: 290px; flex-basis: 290px; }
  .city-rail { width: 175px; flex-basis: 175px; }
}
@media (max-width: 820px) {
  .city-rail { display: none; }
  .side-panel {
    position: fixed; right: 0; top: 52px; bottom: 0; z-index: 60;
    width: 300px; box-shadow: var(--shadow); transform: translateX(100%);
    transition: transform .2s;
  }
  .side-panel.open { transform: translateX(0); }
  .hud-top .res .lbl { display: none; }
}
