:root {
  --bg: #0f1216;
  --panel: #171b21;
  --border: #262c35;
  --text: #e7ebf0;
  --muted: #8b96a5;
  --accent: #3d8bfd;
  --accent-hover: #5a9dff;
  --danger: #f36767;
  --ok: #4ec98a;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f6f9;
    --panel: #ffffff;
    --border: #dfe4ea;
    --text: #1a1f26;
    --muted: #6b7684;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --danger: #d63a3a;
    --ok: #17915c;
  }
}

* { box-sizing: border-box; }

/* **左右滑不许翻页**(用户 2026-09-13)。横向滚到头还接着滑, Chrome / Edge / 安卓
   会当成"上一页/下一页" —— 在牌桌上误滑一下就退出去了。
   这一条只封导航手势, 页面自己的横向滚动(宽表格之类)照常。
   iOS 的边缘回扫是系统手势, CSS 管不着, 由 auth.js 那段 touchmove 兜住。 */
html, body { overscroll-behavior-x: none; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, "Segoe UI", "Microsoft YaHei", Roboto, sans-serif;
}

/* ---------- 登录页 ---------- */

.center {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px;
}

.brand {
  text-align: center;
  margin-bottom: 24px;
}

.brand h1 {
  margin: 0 0 4px;
  font-size: 22px;
  letter-spacing: 1px;
}

.brand p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 4px;
  margin-bottom: 20px;
}

.tabs button {
  flex: 1;
  padding: 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}

.tabs button[aria-selected="true"] {
  background: var(--accent);
  color: #fff;
}

/* **必须放在 label 之前**: `hidden` 属性靠浏览器默认的 `display:none` 生效,
   而下面 `label { display:block }` 的优先级比它高 —— 于是 hidden 的字段照样显示。
   登录页上"姓名/昵称藏不住"就是这么来的, 而且用 JS 查 el.hidden 还是 true, 查不出来。 */
[hidden] { display: none !important; }

label {
  display: block;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--muted);
}

/* 输入框下面那行小字说明(比如注册时"姓名"是干什么用的)。
   放 placeholder 里的话一开始打字就没了, 而这类说明恰恰是填的时候最需要看见。 */
.field-note {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  color: var(--muted);
  opacity: .8;
}

input {
  width: 100%;
  margin-top: 5px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
}

input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: transparent;
}

/* 勾选框那一行(登录页的「记住我」)。上面那条 input 规则给的是**输入框**的样子
   —— 宽度 100%、10px 内边距, 套到 checkbox 上会变成一个巨大的方块, 所以这儿单独收回来。
   整行可点: 手机上只点那个 14px 的小方块太难点中。 */
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  cursor: pointer;
  user-select: none;
}
.check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  flex: none;
  accent-color: var(--accent);
}
.check span { font-size: 13px; color: var(--muted); }

.btn {
  width: 100%;
  padding: 11px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn:hover:not(:disabled) { background: var(--accent-hover); }
.btn:disabled { opacity: .55; cursor: default; }

.hint {
  margin-top: 14px;
  font-size: 13px;
  min-height: 20px;
  text-align: center;
}

.hint.err { color: var(--danger); }
.hint.ok  { color: var(--ok); }

.rule {
  color: var(--muted);
  font-size: 12px;
  margin: -8px 0 16px;
}

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

.lobby {
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 20px 20px;
}

.lobby-title {
  margin: 0 0 18px;
  font-size: 18px;
  font-weight: 600;
}

/* 在线人数: 跟在标题后面, 轻一档 —— 它是背景信息, 不该跟标题抢注意力 */
.online {
  margin-left: 10px;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}
.online.bad { color: #c2560f; }

.rooms {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 10px;
}

/* 卡片是**横向**的: 左边一块图标, 右边文字。竖排(图在上、字在下)那版一张卡就 190px 高,
   六个入口要滚一屏半; 横过来之后单卡 76px, 整个大厅一眼看完。 */
.room {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  position: relative;
  min-height: 74px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  transition: border-color .15s, transform .15s;
}

a.room:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.room.disabled {
  opacity: .55;
  cursor: not-allowed;
}

.room-art {
  width: 76px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
}

.art-mahjong { background: linear-gradient(160deg, #1b4237, #0f2a22); }
.art-newai   { background: linear-gradient(160deg, #3d2f14, #17100b); }
.art-online  { background: linear-gradient(160deg, #33334d, #1c1c2b); }
.art-board   { background: linear-gradient(160deg, #2a3b52, #17222f); }
.art-replay  { background: linear-gradient(160deg, #4a2f3f, #241722); }
.art-admin   { background: linear-gradient(160deg, #43384f, #221c2b); }
.art-stats   { background: linear-gradient(160deg, #1e3a4f, #12212c); }
.art-tournament { background: linear-gradient(160deg, #4a3a18, #241c0e); }
.art-guild      { background: linear-gradient(160deg, #1f4340, #122824); }

.room-body { padding: 11px 14px; flex: 1; min-width: 0;
              display: flex; flex-direction: column; justify-content: center; }

.room-name { font-size: 15px; font-weight: 600; margin-bottom: 3px; }

.room-desc {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
  /* 右边给角标让出位置, 否则长说明会钻到"可进入"底下 */
  padding-right: 58px;
  /* 最多两行, 超了省略 —— 说明长短不一时卡片高度参差, 一排看过去很乱 */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 角标钉在卡片右上角。放在文字流里的话每张卡都要多出一行的高度,
   而它只是个状态字, 不值这个高度。 */
.room-tag {
  position: absolute;
  top: 10px;
  right: 12px;
  padding: 2px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
}

.room-tag.ok { border-color: var(--ok); color: var(--ok); }

/* 大厅内的页脚跟着卡片左对齐, 不要白板页那套左右留白 */
.lobby .foot { padding: 18px 0 0; }

/* ---------- 游戏壳子 ---------- */
/* iframe 里的游戏按视口高度排版, 所以壳子自己不能滚动 */

body.game-page {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.gamebar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.game-title { color: var(--muted); font-size: 13px; }

.game-frame {
  flex: 1;
  width: 100%;
  border: 0;
  display: block;
}

/* ---------- 白板页 ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.who { font-weight: 600; }
.who span { color: var(--muted); font-weight: 400; margin-left: 8px; font-size: 13px; }

.spacer { flex: 1; }

.tool {
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.tool:hover { border-color: var(--accent); }

input[type="color"] {
  width: 38px;
  height: 32px;
  margin: 0;
  padding: 2px;
  cursor: pointer;
}

input[type="range"] { width: 110px; margin: 0; padding: 0; }

.board-wrap { padding: 16px 20px 20px; }

canvas {
  width: 100%;
  height: 72vh;
  display: block;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: crosshair;
  touch-action: none;
}

.foot {
  color: var(--muted);
  font-size: 12px;
  padding: 0 20px 20px;
}

code {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 12px;
  word-break: break-all;
}

/* ---------- 观战列表(live.js 用, 四个页面共用) ---------- */
/* 设计见 docs/SPECTATE.md: 列表长在各自的末级页面上, 所以样式要能塞进
   段位场的档位卡片下面、娱乐场的班卡片下面、赛事详情页里 —— 一律做成窄条。 */
/* 观战列表是挂在上面那张卡片下面的**第二层**: 缩进 + 左边一条竖线, 与卡片拉开层次
   (用户 2026-08-19: 两种类型排成一列不好看)。赛事详情页/约战页本身就是独立一节,
   调用方传 indent:false 就不缩进。 */
.lv-block.lv-in { margin: -4px 0 10px 34px; padding-left: 12px; border-left: 2px solid var(--border); }
.lv-block { margin: 4px 0 10px; }

/* 收/开。桌子多了这一段会很长, 给个把手收起来(用户 2026-08-19) */
.lv-toggle {
  background: transparent; border: 0; color: var(--muted); cursor: pointer;
  font-size: 12px; padding: 3px 2px; display: flex; align-items: center; gap: 5px;
}
.lv-toggle:hover { color: var(--text); }
.lv-toggle b { color: var(--accent); }
.lv-caret { font-size: 10px; }

.lv-list { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 2px; }
.lv-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px;
          border-radius: 9px; background: rgba(127,127,127,.08);
          border: 1px solid var(--border); }
.lv-col { flex: 1; min-width: 0; }
.lv-head { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.lv-eye { color: var(--accent); }
.lv-eye.off { color: var(--muted); }
.lv-seats { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 3px; font-size: 13px; }
/* 桌子列表里名字前面那张头像(用户 2026-08-24)。**样式写在这儿而不是 live.js 里** ——
   .lv-p 本来就在这个文件里定的, 分两处写迟早改一处漏一处。图集和取格逻辑见 avatar.js。 */
.lv-p .av { width: 1.5em; height: 1.5em; margin-right: 5px; vertical-align: -.35em; }
.lv-p { white-space: nowrap; }
.lv-p.off { color: var(--muted); }            /* 掉线托管中的那家 */
.lv-ai { font-style: normal; font-size: 10px; color: var(--muted);
         border: 1px solid var(--border); border-radius: 3px; padding: 0 3px; margin-left: 4px; }
.lv-acts { flex: none; display: flex; gap: 6px; }
.lv-btn { font-size: 13px; padding: 6px 11px; border-radius: 8px; cursor: pointer;
          border: 1px solid var(--border); background: transparent; color: var(--text);
          text-decoration: none; white-space: nowrap; }
.lv-btn.pri { background: var(--accent); border-color: var(--accent); color: #fff; }
.lv-btn:disabled { opacity: .45; cursor: not-allowed; }
/* 按钮上那句"还差 N 分" —— 让人干等是最糟的做法, 差多久要写在按钮上 */
.lv-eta { font-size: 11px; opacity: .85; }
.lv-empty { color: var(--muted); font-size: 12px; padding: 6px 2px; }

@media (max-width: 480px) {
  .lv-row { flex-wrap: wrap; }
  .lv-acts { width: 100%; justify-content: flex-end; }
}

/* 次级分页条(段位场/统计页/赛事详情共用)。**只有这一份** ——
   从前 match.html 和 stats.html 各抄了一份, 两处只差一个 margin;
   赛事页 2026-08-24 要用第三份时收到这儿(用户: "要遵循代码复用原则")。 */
.tabs2 { display: flex; gap: 6px; margin: 4px 0 14px; flex-wrap: wrap; }
.tabs2 button {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  padding: 5px 12px; border-radius: 7px; font-size: 13px; cursor: pointer;
}
.tabs2 button[aria-selected="true"] { border-color: var(--accent); color: var(--accent); }
