

:root {
  /* presence.css（在线玩家名单）的配色，覆盖成 Orbit 的浅色主题 */
  --op-card-bg: #f1efe9;
  --op-card-fg: #2a2521;
  --op-line: rgba(0, 0, 0, 0.08);
  --op-accent: #6b4a34;
  --op-watch: #c46a1e;
  --op-hover: rgba(107, 74, 52, 0.1);
  --wood-line: #785c3e;
  --panel-bg: #f1efe9;
  --btn-brown: #6b4a34;
  --btn-brown-dark: #55392a;
  --text-dark: #2a2521;
  --accent-purple: rgba(124,92,214,0.7);
  --accent-orange: #e0862c;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--panel-bg);
  color: var(--text-dark);
}

/* ---- Shared layout: side rack + center board ---- */
.layout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  width: 100%;
  padding: 24px 12px;
  flex-wrap: wrap;
}
.side-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  min-width: 84px;
}
.left-stack { order: 0; display: flex; flex-direction: column; align-items: center; gap: 22px; }
.left-stack .side-col.left { order: 0; }
.left-stack .controls-col { order: 1; }
.board-col { order: 2; display:flex; flex-direction:column; align-items:center; gap:10px; }
.side-col.right { order: 3; }
.controls-col { display: flex; flex-direction: column; gap: 10px; width: 210px; }

.piece-slot {
  position: relative;
  width: 76px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  cursor: default;
}
.piece-slot.interactive { cursor: pointer; }
.piece-slot.interactive:hover { background: rgba(0,0,0,0.05); }
.piece-slot.blocked { opacity: 0.4; }   /* rules v3: pawn drop not allowed this turn (last turn was a pawn drop) */
.piece-slot { position: relative; }
.cooldown-badge { position: absolute; top: 2px; left: 2px; min-width: 18px; height: 18px; line-height: 18px; padding: 0 3px; box-sizing: border-box; border-radius: 0; background: #c0392b; color: #fff; font-size: 12px; font-weight: 700; text-align: center; }
.piece-slot.selected { background: rgba(124,92,214,0.18); box-shadow: 0 0 0 2px rgba(124,92,214,0.6) inset; }
.piece-slot img { width: 62px; height: 62px; object-fit: contain; pointer-events: none;
  filter: drop-shadow(0 2.5px 3px rgba(0,0,0,0.55)); }   /* 2026-11-24：跟棋盘上的棋子一样带软阴影（视频 V9） */
.piece-slot.depleted img { opacity: 0.5; }
/* 手里棋子旁的方格数字（视频 V9 的样子：深色方块、铜色边、浅色粗体数字） */
.piece-count {
  position: absolute;
  bottom: -2px; right: -2px;
  background: #1e1915;
  color: #f2e8d6;
  border: 1.5px solid #aa865c;
  border-radius: 0;
  width: 22px; height: 22px;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.menu-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 0;
  border: 1.5px solid var(--btn-brown);
  background: #fff;
  color: var(--text-dark);
  font-size: 15px;
  cursor: pointer;
  text-align: left;
}
.menu-btn.primary { background: var(--btn-brown); color: #fff; border-color: var(--btn-brown); }
.menu-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.menu-btn .icon { width: 20px; text-align: center; }
a.menu-btn { text-decoration: none; display: inline-flex; }

/* 配对成功弹窗里"进入对局 / 关闭"这两个按钮的容器——
   原来只有一个"关闭"按钮，现在多了个真链接，见 orbit_app.js
   showMatchedState()。 */
.matched-actions { display: flex; gap: 8px; margin-top: 10px; }
.matched-actions .menu-btn { flex: 1; justify-content: center; }

.ai-config-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
  padding: 12px;
  border-radius: 0;
  border: 1.5px solid var(--btn-brown);
  background: rgba(255,255,255,0.6);
}
.config-label { font-size: 13px; font-weight: 600; color: var(--text-dark); margin-top: 4px; }
.config-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-btn {
  padding: 6px 12px;
  border-radius: 0;
  border: 1.5px solid var(--btn-brown);
  background: #fff;
  color: var(--text-dark);
  font-size: 13px;
  cursor: pointer;
}
.chip-btn.active { background: var(--btn-brown); color: #fff; }

.gear-btn {
  width: 40px; height: 40px;
  border-radius: 0;
  border: none;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  align-self: flex-start;
}

.board-svg-wrap { width: min(88vw, 560px); position: relative; }
.board-svg-wrap svg { width: 100%; height: auto; display: block; }

.cellhit { transition: fill 0.12s; }
.cellhit:hover { fill: rgba(124,92,214,0.12); }
.cellhit.selected-cell { fill: rgba(124,92,214,0.22); }

.turn-indicator {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 600;
  margin-top: 6px;
}
.turn-dot { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--text-dark); }
.turn-dot.white { background: #fff; }
.turn-dot.black { background: #2a2521; }

.finish-btn {
  padding: 8px 18px;
  border-radius: 0;
  border: none;
  background: #2e9e5b;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.finish-btn:hover { background: #26824c; }

.banner {
  position: fixed; inset: 0;
  background: rgba(20,16,12,0.55);
  display: none;
  align-items: center; justify-content: center;
  z-index: 50;
}
.banner.show { display: flex; }
.banner-card {
  background: #fff; border-radius: 0; padding: 28px 36px;
  text-align: center; border: 1.5px solid var(--btn-brown);
}
.banner-card h2 { margin: 0 0 8px; font-size: 22px; }
.banner-card button { margin-top: 14px; padding: 10px 20px; border-radius: 0; border: none; background: var(--btn-brown); color: #fff; font-size: 14px; cursor: pointer; }

.hint-text {
  font-size: 13px;
  color: var(--accent-orange);
  font-weight: 600;
  min-height: 18px;
}

.reset-btn {
  position: absolute;
  left: 6px; bottom: 6px;
  padding: 7px 14px;
  border-radius: 0;
  border: 1.5px solid var(--btn-brown);
  background: #fff;
  color: var(--btn-brown);
  font-size: 13px;
  cursor: pointer;
}
.reset-btn:hover { background: rgba(0,0,0,0.04); }

.arrived-row {
  display: flex;
  gap: 8px;
  margin-top: -4px;
}
.arrived-slot {
  width: 34px; height: 34px;
  border-radius: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px dashed rgba(0,0,0,0.25);
}
.arrived-slot.filled { border-style: solid; border-color: rgba(0,0,0,0.15); background: rgba(0,0,0,0.03); }
.arrived-slot img { width: 24px; height: 24px; object-fit: contain; }

@media (max-width: 720px) {
  .layout { flex-direction: column; }
  .side-col.left, .side-col.right { flex-direction: row; }
  .board-col { order: 0; position: relative; }
  .controls-col { width: 100%; max-width: 320px; }
}

/* ---- Play online: lobby, same light wood tone as the rest of Orbit ---- */
.lobby-screen {
  display: flex;
  min-height: 100vh;
  background: var(--panel-bg);
  color: var(--text-dark);
  font-size: 14px;
}
.lobby-sidebar {
  width: 130px;
  flex-shrink: 0;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
/* ---- 侧栏固定在屏幕上（2026-09-28）：不随页面滚动，玩家名钉在屏幕左下角（见 home.css 同名注释）---- */
@media (min-width: 901px) {
  .lobby-sidebar {
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
  }
}
.lobby-brand { color: var(--btn-brown); font-size: 20px; font-weight: 700; letter-spacing: 0.02em; }
.lobby-nav { display: flex; flex-direction: column; gap: 14px; }
.lobby-nav-item { color: var(--text-dark); text-decoration: none; cursor: pointer; font-size: 14px; }
.lobby-nav-item.active { color: var(--btn-brown); font-weight: 700; }
.lobby-nav-item.disabled { color: #b8afa5; cursor: not-allowed; }

/* 站点切换：Orbit(四轮) / Numerith(数弈)，跟
   home.css 里 #site-switch 的样式对应，只是配色
   换成浅色木纹主题。 */
.site-switch {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid rgba(0,0,0,.1);
}
.site-switch-btn {
  background: none; border: none; padding: 0;
  text-align: left; font-size: 13px; cursor: pointer;
  color: var(--text-dark);
}
.site-switch-btn:hover { opacity: 0.75; }
.site-switch-btn.is-active { color: var(--btn-brown); font-weight: 700; cursor: default; }

/* 左下角账号 UI——跟 home.css 里 #account/#avatar/#account-name
   同一套结构和尺寸，颜色换成 Orbit 自己的浅色木纹主题。
   用 margin-top:auto 贴住侧栏底部；上面 .site-switch 已经有一个
   margin-top:auto，两个 auto 会平分剩余空间，效果是"导航在顶，
   站点切换和账号一起贴底，两者中间留一条缝"——跟 home.css 里
   #site-switch 和 #sidebar-foot 的关系是同一个做法。 */
.lobby-account-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 6px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dark);
}
.lobby-account-btn:hover { color: var(--btn-brown); }
.lobby-avatar {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border-radius: 0;
  background: rgba(0,0,0,.08);
  display: grid;
  place-items: center;
  font-size: 10px;
  color: var(--text-dark);
}
.lobby-account-name {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lobby-content {
  flex: 1;
  padding: 24px 28px;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 440px) 300px;
  grid-template-areas:
    "table   actions"
    "history leaderboard";
  column-gap: 18px;
  row-gap: 22px;
  align-items: start;
  align-content: start;
  max-width: 800px;
}
.lobby-block-table { grid-area: table; }
.lobby-block-actions { grid-area: actions; display: flex; flex-direction: column; gap: 12px; }
.lobby-block-history { grid-area: history; }
.lobby-block-leaderboard { grid-area: leaderboard; }

/* 有进行中的对局时，左边多出一列实时小棋盘（orbit_app.js 加 has-live） */
.lobby-content.has-live {
  grid-template-columns: 190px minmax(0, 440px) 300px;
  grid-template-areas:
    "live table   actions"
    "live history leaderboard";
  max-width: 1010px;
}
.lobby-block-live { grid-area: live; }
.lobby-block-live[hidden] { display: none; }
#lobby-live-games { display: flex; flex-direction: column; gap: 14px; }
.lobby-live-card { cursor: pointer; text-decoration: none; color: var(--text-dark); display: block; }
.lobby-live-card svg { width: 100%; height: auto; display: block; pointer-events: none; }
.lobby-live-card:hover svg { filter: brightness(1.04); }
.lobby-live-names { font-size: 12px; margin-top: 4px; display: flex; flex-direction: column; gap: 1px; }
.lobby-live-names span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 大厅左栏最上面的谜题卡片（orbit_app.js 的 loadLobbyPuzzle） */
.lobby-puzzle-label { font-size: 13px; font-weight: 700; color: var(--btn-brown); text-transform: lowercase; margin-bottom: 4px; }
.lobby-puzzle-solve { color: var(--btn-brown); font-weight: 600; }
.lobby-online-list { padding: 4px 14px 10px; }

.lobby-title { color: var(--btn-brown); font-size: 22px; font-weight: 700; margin: 0 0 14px; }
.lobby-title-sm { font-size: 18px; }
.lobby-panel { background: #fff; border-radius: 0; overflow: hidden; border: 1.5px solid var(--btn-brown); }
.lobby-table-head {
  display: grid;
  grid-template-columns: 1fr 70px 70px 70px;
  padding: 12px 16px;
  background: rgba(107,74,52,0.08);
  color: var(--btn-brown);
  font-size: 13px;
  font-weight: 600;
  text-align: right;
}
.lobby-table-head span:first-child { text-align: left; }
.lobby-empty-state {
  padding: 36px 16px;
  text-align: center;
  color: #8a7f72;
  font-size: 14px;
}
.lobby-empty-state-sm { padding: 16px; font-size: 13px; line-height: 1.6; text-align: left; }
.lobby-history-panel { min-height: 80px; }

.lobby-action-btn {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 18px 20px;
  background: #fff; border: 1.5px solid var(--btn-brown); border-radius: 0;
  color: var(--text-dark); font-size: 16px; font-weight: 600; text-align: left; cursor: pointer;
}
.lobby-action-btn:hover:not(:disabled) { background: rgba(107,74,52,0.06); }
.lobby-action-btn:disabled { color: #b8afa5; border-color: #d8d0c5; cursor: not-allowed; }
.lobby-icon { font-size: 19px; }
.lobby-panel-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; color: var(--btn-brown); font-size: 14px; font-weight: 700;
  background: rgba(107,74,52,0.08);
}
.lobby-more { color: var(--btn-brown); font-size: 12px; font-weight: 400; cursor: pointer; text-decoration: underline; }

@media (max-width: 900px) {
  .lobby-screen { flex-direction: column; }
  .lobby-sidebar { width: 100%; flex-direction: row; align-items: center; flex-wrap: wrap; padding: 14px; }
  .lobby-nav { flex-direction: row; flex-wrap: wrap; gap: 12px; }
  .lobby-account-btn, .site-switch { margin-top: 0; margin-left: auto; }
  .lobby-content {
    grid-template-columns: 1fr;
    grid-template-areas: "table" "actions" "history" "leaderboard";
  }
  .lobby-content.has-live {
    grid-template-columns: 1fr;
    grid-template-areas: "table" "actions" "live" "history" "leaderboard";
    max-width: none;
  }
  #lobby-live-games { flex-direction: row; overflow-x: auto; }
  .lobby-live-card { flex: 0 0 150px; }
  .lobby-content {
    max-width: none;
    padding: 16px;
  }
  .lobby-table-head { grid-template-columns: 1fr 60px 60px 60px; font-size: 12px; padding: 10px 12px; }
}

/* ---- Account: login / register / guest modal ---- */
.account-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 10px 14px; margin-bottom: 10px;
  background: #fff; border: 1.5px solid var(--btn-brown); border-radius: 0;
  color: var(--text-dark); font-size: 14px; font-weight: 600; text-align: left; cursor: pointer;
}
.account-btn:hover { background: rgba(107,74,52,0.06); }
.account-btn .icon { font-size: 15px; }

.modal-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(42,37,33,0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.account-modal {
  background: var(--panel-bg); border: 1.5px solid var(--btn-brown); border-radius: 0;
  padding: 24px; width: 100%; max-width: 340px;
  display: flex; flex-direction: column; gap: 10px;
}
.account-modal-title { margin: 0 0 4px; color: var(--btn-brown); font-size: 20px; font-weight: 700; }
.account-field-group { display: flex; flex-direction: column; gap: 10px; }
.account-input {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--btn-brown); border-radius: 0;
  background: #fff; color: var(--text-dark); font-size: 15px; font-family: inherit;
}
.account-error { color: #b8452f; font-size: 13px; min-height: 1em; }
.account-submit-btn { margin-top: 4px; }
.account-note { text-align: center; }
.link-btn {
  background: none; border: none; color: var(--btn-brown); font-size: 13px;
  text-decoration: underline; cursor: pointer; padding: 2px;
}
.account-info-body { font-size: 14px; line-height: 1.8; color: var(--text-dark); }

/* ---- Create-game panel ---- */
.create-game-modal { max-width: 380px; }
.time-control-row { display: flex; align-items: center; gap: 8px; }
.time-select {
  flex: 1; padding: 10px; border: 1.5px solid var(--btn-brown); border-radius: 0;
  background: #fff; color: var(--text-dark); font-size: 15px; font-family: inherit;
}
.time-plus { font-weight: 700; color: var(--btn-brown); }

/* ---- Real lobby rows ---- */
.lobby-row {
  display: grid; grid-template-columns: 1fr 70px 70px 70px;
  padding: 12px 16px; align-items: center; font-size: 14px;
  border-top: 1px solid rgba(107,74,52,0.15); cursor: pointer;
}
.lobby-row:hover { background: rgba(107,74,52,0.05); }
.lobby-row-owner { display: flex; align-items: center; gap: 8px; text-align: left; }
.lobby-row-side-dot {
  width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0;
  border: 1.5px solid var(--btn-brown);
}
.lobby-row-side-dot.side-white { background: #fff; }
.lobby-row-side-dot.side-black { background: #2a2521; }
.lobby-row-side-dot.side-random { background: linear-gradient(135deg, #fff 50%, #2a2521 50%); }
.lobby-row span:not(.lobby-row-owner) { text-align: right; }

/* 大厅"对局记录"卡片（orbit_app.js 的 refreshLobbyHistory） */
.lobby-history-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 14px;
  border-top: 1px solid rgba(107, 74, 52, 0.12);
  color: var(--text-dark);
  text-decoration: none;
  font-size: 13px;
}
.lobby-history-card:first-child { border-top: none; }
.lobby-history-card:hover { background: rgba(107, 74, 52, 0.05); }
.lhc-top { display: flex; justify-content: space-between; font-size: 12px; opacity: 0.65; }
.lhc-players { text-align: center; font-weight: 600; }
.lhc-result { text-align: center; color: var(--btn-brown); font-size: 12px; }

/* 大厅里 AI 棋手（Alpha）名字后面的 "AI" 标记，跟数弈大厅一样 */
.lobby-ai-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 0 4px;
  margin-left: 4px;
  border: 1px solid currentColor;
  border-radius: 0;
  opacity: 0.6;
  vertical-align: 1px;
}

/* 矩形界面（参照 Numerith）：共用的在线名单 / 设置窗口只在 Orbit 里改成直角 */
html[data-site="orbit"] .op-btn,
html[data-site="orbit"] .op-modal-card,
html[data-site="orbit"] .op-toast,
html[data-site="orbit"] .return-banner,
html[data-site="orbit"] button,
html[data-site="orbit"] select,
html[data-site="orbit"] input { border-radius: 0; }

/* 版面细节对齐 Numerith 大厅（numerith.online）：平面色块、常规字重、54px 高的居中按钮；
   颜色和描边仍是 Orbit 的棕色。暗色主题由 theme.css 的更高优先级规则覆盖。 */
.lobby-title { font-size: 19px; font-weight: 400; color: var(--text-dark); margin-bottom: 8px; }
.lobby-title-sm { font-size: 18px; }
.lobby-panel { background: #e6e1da; }
.lobby-table-head, .lobby-panel-head { background: #dbd4cb; font-weight: 400; color: var(--text-dark); }
.lobby-panel-head { font-size: 15px; }
.lobby-empty-state { color: #7d7268; }
.lobby-action-btn {
  min-height: 54px; padding: 10px 16px; justify-content: center;
  background: #e6e1da; font-weight: 400; text-align: center;
}
.lobby-action-btn:hover:not(:disabled) { background: #dbd4cb; }
.menu-btn, .account-btn, .chip-btn, .reset-btn { background: #e6e1da; font-weight: 400; }
.menu-btn:hover:not(.primary):not(:disabled), .account-btn:hover, .chip-btn:hover:not(.active), .reset-btn:hover { background: #dbd4cb; }
.menu-btn.primary, .chip-btn.active { background: var(--btn-brown); color: #fff; }
.lobby-brand { font-weight: 400; }

/* 登录 / 注册窗口：版式照 Numerith（标题栏 + 输入区 + 底部按钮区，分隔线隔开），颜色用 Orbit 的棕色 */
#account-overlay { background: rgba(0, 0, 0, .55); padding: 20px; }
.auth-modal { width: 366px; max-width: 100%; max-height: 90vh; overflow-y: auto; padding: 0; gap: 0; display: block; background: #e6e1da; }
.auth-title {
  margin: 0; padding: 15px 16px; text-align: center;
  font-size: 17px; font-weight: 400; color: var(--text-dark);
  border-bottom: 1px solid rgba(107, 74, 52, 0.35);
}
.auth-block { padding: 20px 24px 20px; border-bottom: 1px solid rgba(107, 74, 52, 0.35); }
.auth-block .account-input { display: block; padding: 10px 12px; margin-bottom: 12px; font-size: 14px; background: var(--panel-bg); }
.auth-block .account-input:focus { outline: none; border-color: var(--accent-orange); }
.auth-hint { font-size: 12px; color: #7d7268; }
.auth-modal .account-error { min-height: 0; padding: 0 24px; text-align: center; }
.auth-modal .account-error:not(:empty) { padding: 12px 24px 0; }
.auth-foot { padding: 16px 24px 20px; text-align: center; }
.auth-foot .account-submit-btn { width: 100%; margin-top: 0; justify-content: center; text-align: center; }
.auth-foot .account-submit-btn:disabled { opacity: 0.6; cursor: default; }
.auth-foot .account-note { margin-top: 10px; }
.auth-note { margin-top: 8px; font-size: 12px; color: #7d7268; }

/* 骏马的 "✓ Finished"：棋盘正下方，占一行固定高度（按钮出现 / 消失时棋盘不跳） */
.board-col #finish-btn-holder { min-height: 40px; display: flex; justify-content: center; align-items: center; }
