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

:root {
  --bg: #f3f2fb;
  --bg-a: #f3f2fb;
  --bg-b: #e6e2f8;
  --panel: #ffffff;
  --panel-soft: #fcfcff;
  --ink: #262b3d;
  --muted: #7a8098;
  --brand: #5b4bd6;
  --brand-dark: #4336ad;
  --green: #2e8b57;
  --red: #c0392b;
  --gold: #c8791e;
  --line: #dfe2f0;
  --line-soft: #eef0f8;
  --brand-soft: #f1eefc;
  --brand-soft-hover: #e6e0fb;
  --brand-soft2: #faf9fe;
  --brand-line: #cfc6f2;
  --soft-neutral: #f1f1f4;
  --soft-neutral2: #eef1f8;
  --green-soft: #e3f4e9;
  --green-ink: #1e6f42;
  --red-soft: #fdeceb;
  --gold-soft: #fdf3e3;
  --toast-bg: #333;
  --shadow-tint: rgba(60, 50, 160, .07);
  --shadow-hero: rgba(60, 50, 160, .12);
  --shadow-flash: rgba(91, 75, 214, .55);
  --shadow-focus: rgba(91, 75, 214, .12);
  --shadow-ctrl: rgba(91, 75, 214, .24);
  --modal-scrim: rgba(30, 28, 60, .45);
}

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  background: linear-gradient(160deg, var(--bg-a) 0%, var(--bg-b) 100%);
  color: var(--ink);
  min-height: 100vh;
}

#app { max-width: 1080px; margin: 0 auto; padding: 18px 14px 8px; position: relative; z-index: 1; }

/* ---------- 动态背景承载层（游戏背景 iframe，只换背景不换配色） ---------- */
#hub-bg-layer {
  position: fixed;
  top: calc(0px - env(safe-area-inset-top, 0px));
  right: 0;
  bottom: calc(0px - env(safe-area-inset-bottom, 0px));
  left: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  contain: layout paint;
}
#hub-bg-layer iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: none;
  background: transparent;
  opacity: 0;
  transition: opacity .25s ease;
  transform: translateZ(0);
  will-change: transform;
}
#hub-bg-layer iframe.hub-bg-loaded {
  opacity: 1;
}
/* 站长上传的图片 / GIF / 视频壁纸：铺满屏幕、居中裁切 */
#hub-bg-layer .hub-bg-media {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .25s ease;
}
#hub-bg-layer .hub-bg-media.hub-bg-loaded {
  opacity: 1;
}
html.hub-bg-on #skin-bg,
html.hub-bg-on #bg-scene {
  display: none !important;
}
/* 触摸设备滚动时暂停所有页面背景动画，避免与滑动抢帧率 */
@media (pointer: coarse) {
  html.hub-scrolling #bg-scene,
  html.hub-scrolling #bg-scene *,
  html.hub-scrolling #skin-bg,
  html.hub-scrolling #skin-bg *,
  html.hub-scrolling #pskin-bg-layer .pskin-bg-img {
    animation-play-state: paused !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  #hub-bg-layer iframe { display: none !important; }
}

.hidden { display: none !important; }

.btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 14px;
  cursor: pointer;
  transition: transform .06s ease, background .12s ease, box-shadow .12s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 3px 10px rgba(0,0,0,.12); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px var(--shadow-tint);
}

.made-by {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 12px 0 6px;
}

/* ---------- 个人中心 ---------- */

.fav-section { margin-bottom: 14px; }
.fav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.fav-section .group-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--brand-dark);
  margin-bottom: 8px;
  padding-left: 4px;
}
.fav-head .group-title { margin-bottom: 0; }
.fav-head-btns { display: inline-flex; align-items: center; gap: 6px; }
.fav-head-btns .btn { padding: 4px 9px; font-size: 12px; border-radius: 7px; }
.fav-edit-hint { font-size: 12px; color: var(--muted); margin: 0 4px 8px; }
.fav-cards { display: flex; flex-wrap: wrap; gap: 8px; }
.fav-card {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
  color: var(--ink);
  text-decoration: none;
  transition: transform .06s ease, box-shadow .12s ease;
}
.fav-card:hover { transform: translateY(-1px); box-shadow: 0 3px 10px rgba(0,0,0,.12); }
.fav-card.off { opacity: .5; cursor: not-allowed; }
.fav-card.edit { cursor: default; }
.fav-card.edit:hover { transform: none; box-shadow: 0 2px 8px var(--shadow-tint); }
.fav-icon { font-size: 15px; }
.fav-order-btns { display: inline-flex; flex-direction: column; gap: 1px; }
.fav-order-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--brand);
  border-radius: 5px;
  font-size: 9px;
  line-height: 1;
  padding: 3px 5px;
  cursor: pointer;
}
.fav-order-btn:hover:not(:disabled) { background: var(--brand-soft); }
.fav-order-btn:disabled { opacity: .35; cursor: not-allowed; }
.fav-name-input {
  width: 118px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 4px 7px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  background: var(--panel);
}
.fav-name-input:focus { outline: none; border-color: var(--brand); }
.fav-remove {
  border: none;
  background: transparent;
  color: var(--red);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 6px;
}
.fav-remove:hover { background: var(--red-soft); }

.gc-fav { color: var(--muted); }
.gc-fav.on { color: var(--gold); }
.gc-fav,
.gc-copy {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.gc-fav:hover:not(:disabled),
.gc-copy:hover:not(:disabled) {
  background: var(--brand-soft);
  border-color: var(--line);
}
.gc-btns { display: inline-flex; align-items: center; gap: 6px; }

.modal {
  position: fixed;
  inset: 0;
  background: var(--modal-scrim);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 14px;
  z-index: 100;
  overflow-y: auto;
}
/* 弹窗位于 #app 内，而固定模糊顶栏是它的兄弟层；打开弹窗时提升整个应用层级。 */
#app:has(.modal:not(.hidden)) { z-index: 41; }
/* 2026-11-10 弹窗必须压在顶部固定毛玻璃栏上面：html.hub-modal-open 由 index.html 小脚本维护，
   不依赖 :has；打开时顶栏/分类栏去掉毛玻璃并让到下面，弹窗自成合成层，避开手机内核的叠层错误。 */
.modal { z-index: 200; -webkit-transform: translateZ(0); transform: translateZ(0); }
html.hub-modal-open #app { z-index: 41; }
html.hub-modal-open #topbar,
html.hub-modal-open #app .cat-nav {
  z-index: 1 !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}
.modal-card {
  background: var(--panel);
  border-radius: 16px;
  padding: 16px;
  width: 100%;
  max-width: 620px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.game-intro-card { max-width: 460px; }
.game-intro-cat {
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
  margin-bottom: 8px;
}
.game-intro-text {
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--brand-soft2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}
.game-intro-date {
  font-size: 12px;
  color: var(--muted);
  margin-top: 10px;
  text-align: right;
}
/* 个人中心：固定不透明白底，不跟随皮肤透明度/毛玻璃 */
#modal-profile {
  --panel: #ffffff;
  --panel-soft: #ffffff;
  --line: #e4e4f0;
  --ink: #1f2437;
  --muted: #6b7280;
}
#modal-profile .modal-card {
  background: #ffffff !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
/* 个人中心内部 / 快捷游戏排序·编辑按钮：透明度和毛玻璃跟随游戏卡片 */
#modal-profile .profile-list,
#modal-profile .fav-check,
#modal-profile .profile-row .rf-input,
#btn-fav-edit,
#btn-fav-sort {
  --panel: var(--skin-panel, #ffffff);
  --panel-soft: var(--skin-panel-soft, #fcfcff);
  --line: var(--skin-line, #dfe2f0);
  --ink: var(--skin-ink, #262b3d);
  --muted: var(--skin-muted, #7a8098);
  background-color: var(--panel);
  border-color: var(--line);
  color: var(--ink);
  -webkit-backdrop-filter: var(--skin-blur, none);
  backdrop-filter: var(--skin-blur, none);
}
html.pskin-on #modal-profile .profile-list,
html.pskin-on #modal-profile .fav-check,
html.pskin-on #modal-profile .profile-row .rf-input,
html.pskin-on #btn-fav-edit,
html.pskin-on #btn-fav-sort {
  background-color: var(--pskin-card, var(--panel));
  color: var(--pskin-font, var(--ink));
  -webkit-backdrop-filter: blur(var(--pskin-blur, 0px));
  backdrop-filter: blur(var(--pskin-blur, 0px));
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close {
  border: none;
  background: transparent;
  font-size: 16px;
  cursor: pointer;
  color: var(--muted);
  padding: 4px 8px;
}
.profile-block { margin: 12px 0; }
.profile-label { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.profile-label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.profile-label-row .profile-label { margin-bottom: 0; }
.fav-tools { display: inline-flex; gap: 6px; }
.profile-row { display: flex; gap: 8px; }
.profile-row .rf-input { flex: 1; }
.profile-hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.profile-favs { display: flex; flex-wrap: wrap; gap: 6px; }
.fav-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 5px 9px;
  font-size: 13px;
  cursor: pointer;
  background: var(--panel);
}
.fav-check.on { border-color: var(--gold); color: var(--gold); background: var(--gold-soft); }
.profile-list { max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.profile-list .status-line { color: var(--muted); font-size: 13px; padding: 4px; }
.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 4px;
  font-size: 13px;
  border-bottom: 1px dashed var(--line);
}
.history-item:last-child { border-bottom: none; }
.h-game { font-weight: 600; }
.h-rank { color: var(--brand); }
.h-note { color: var(--muted); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.badge {
  display: inline-block;
  min-width: 34px;
  text-align: center;
  border-radius: 7px;
  font-size: 12px;
  padding: 2px 6px;
  font-weight: 700;
}
.badge-win { background: var(--green-soft); color: var(--green); }
.badge-loss { background: var(--red-soft); color: var(--red); }
.badge-draw { background: var(--soft-neutral2); color: var(--muted); }
.badge-abandoned { background: var(--gold-soft); color: var(--gold); }
.badge-done { background: var(--soft-neutral2); color: var(--muted); }
.profile-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  gap: 8px;
}
.profile-uid-line { font-size: 12px; color: var(--muted); }
.profile-stats table { width: 100%; }

/* ---------- 个人皮肤 ---------- */
/* 站长工具：全站 UI 开关（隐藏后在线/端口等自动随弹性布局右移） */
html.ui-hide-ctrl .gc-ctrl { display: none !important; }
html.ui-hide-fav .gc-fav { display: none !important; }
html.ui-hide-port .gc-port { display: none !important; }
.pskin-fold summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.pskin-fold summary::-webkit-details-marker { display: none; }
.pskin-fold summary .fold-arrow {
  color: var(--muted);
  font-size: 12px;
  transition: transform .15s ease;
}
.pskin-fold[open] summary .fold-arrow { transform: rotate(90deg); }
.pskin-fold-body { margin-top: 2px; }
.pskin-section { margin-top: 10px; padding: 8px 10px; background: var(--panel-soft); border: 1px solid var(--line-soft); border-radius: 10px; }
.pskin-sub { font-size: 12px; font-weight: 700; color: var(--brand-dark); margin-bottom: 6px; }
.pskin-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pskin-color {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 4px 7px;
  background: var(--panel);
  cursor: pointer;
}
.pskin-color input[type="color"] {
  width: 30px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: none;
  cursor: pointer;
}
.pskin-color input[type="checkbox"] { accent-color: var(--brand); }
.pskin-color.off { opacity: .55; }
.pskin-range { display: block; margin-top: 8px; font-size: 12px; color: var(--muted); }
.pskin-range > span { display: flex; justify-content: space-between; margin-bottom: 2px; }
.pskin-range b { color: var(--ink); font-weight: 700; }
.pskin-range input[type="range"] { width: 100%; accent-color: var(--brand); }
.pskin-stepper {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}
.pskin-stepper input[type="range"] { flex: 1; }
.pskin-stepper button {
  width: 26px;
  height: 26px;
  flex: none;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 7px;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.pskin-stepper button:hover { background: var(--brand-soft); border-color: var(--brand-line); }
.pskin-preview { margin-top: 10px; }
.pskin-preview-label { font-size: 12px; font-weight: 700; color: var(--brand-dark); display: block; margin-bottom: 5px; }
.pskin-preview-card {
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 12px 14px;
  background: var(--panel);
  box-shadow: 0 2px 8px var(--shadow-tint);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pskin-preview-card b { font-size: 15px; }
.pskin-preview-card i { font-style: normal; color: var(--ink); }
.pskin-preview-card .pskin-preview-tag { font-size: 12px; color: var(--muted); }
.pskin-preview-card .pskin-preview-accent {
  display: inline-block;
  align-self: flex-start;
  margin-top: 5px;
  background: var(--brand);
  color: #fff;
  border-radius: 7px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
}
.pskin-bg-preview {
  margin-top: 7px;
  width: 100%;
  height: 84px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.15);
}

/* ---------- 个人皮肤：应用层 ---------- */
#pskin-bg-layer { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
#pskin-bg-layer .pskin-bg-img {
  position: absolute; inset: 0;
  background-size: cover; background-position: center; background-repeat: no-repeat;
}
#pskin-bg-layer .pskin-bg-mask {
  position: absolute; inset: 0;
  -webkit-backdrop-filter: blur(var(--pskin-bgblur, 0px));
  backdrop-filter: blur(var(--pskin-bgblur, 0px));
}
/* 自定义皮肤提供了自己的背景（渐变/壁纸）时才接管页面背景；
   只改卡片颜色/透明度/毛玻璃/字体时，动态背景与原有背景层继续显示 */
html.pskin-on.pskin-has-bg #skin-bg,
html.pskin-on.pskin-has-bg #bg-scene,
html.pskin-on.pskin-has-bg #hub-bg-layer { display: none !important; }
html.pskin-on.pskin-has-bg body {
  background: linear-gradient(160deg, var(--pskin-bg1, var(--bg-a)) 0%, var(--pskin-bg2, var(--bg-b)) 100%) !important;
}
html.pskin-on .game-card,
html.pskin-on .fav-card {
  background-color: var(--pskin-card, var(--panel));
  color: var(--pskin-font, var(--ink));
  -webkit-backdrop-filter: blur(var(--pskin-blur, 0px));
  backdrop-filter: blur(var(--pskin-blur, 0px));
}
html.pskin-on .gc-status,
html.pskin-on .gc-status-text,
html.pskin-on .gc-updated,
html.pskin-on .gc-online-time,
html.pskin-on .gc-fav,
html.pskin-on .group-title,
html.pskin-on .profile-label,
html.pskin-on .at-title,
html.pskin-on .panel-title,
html.pskin-on .made-by {
  color: var(--pskin-label, var(--muted)) !important;
}

.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--toast-bg);
  color: #fff;
  padding: 10px 20px;
  border-radius: 10px;
  z-index: 99;
  font-size: 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
}

/* ---------- 头部 ---------- */

.hero {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 20px 16px;
  margin-bottom: 14px;
  text-align: center;
  box-shadow: 0 8px 24px var(--shadow-hero);
}

.hero-brand {
  /* 桌面端让站名落在卡片正中，logo 贴在站名左侧并保留原间距。 */
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: 14px;
  min-height: 88px;
}

.hero-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 70px;
  height: 64px;
  flex: 0 0 auto;
  grid-column: 1;
  justify-self: end;
  background: transparent !important;
  background-color: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  transform: translateY(-6px);
}

.hero-brand-mark:hover {
  transform: translateY(-6px);
  filter: none;
}

.hero-brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  background: transparent !important;
  background-color: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  filter: none;
}

.hero-brand-mark::before,
.hero-brand-mark::after {
  background: transparent !important;
  box-shadow: none !important;
}

.hero-brand-copy { grid-column: 2; min-width: 0; text-align: center; }

.hero-title {
  font-size: 30px;
  font-weight: 800;
  color: var(--brand-dark);
}

.hero-sub {
  color: var(--muted);
  font-size: 14px;
  margin: 6px 0 12px;
}

.hero-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  margin-bottom: 12px;
}

.conn-status.ok { color: var(--green); font-weight: 700; }
.conn-status.err { color: var(--red); font-weight: 700; }
.last-updated { color: var(--muted); }

.toolbar {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
}

/* ---------- 搜索站内游戏 ---------- */

.search-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
  box-shadow: 0 2px 8px var(--shadow-tint);
}
.search-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.search-title { font-size: 15px; font-weight: 800; color: var(--brand-dark); }
.search-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: var(--panel);
  margin-bottom: 8px;
}
.search-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--shadow-focus); }
.search-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 340px;
  overflow-y: auto;
}
.search-empty { color: var(--muted); font-size: 13px; padding: 10px 4px; text-align: center; }
.search-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--brand-soft2);
  cursor: pointer;
  transition: background .12s ease;
}
.search-row:hover { background: var(--brand-soft); }
.search-icon { font-size: 22px; flex: none; }
.search-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.search-name { font-weight: 700; font-size: 14px; }
.search-cat { font-size: 12px; color: var(--muted); }
.search-enter { flex: none; text-decoration: none; }
.search-enter.off { opacity: .6; cursor: default; }

/* ---------- 继续上一局 ---------- */

.resume-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: linear-gradient(120deg, #fff8e8, #fff3d6);
  border: 1px solid #eccd8a;
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 14px;
  box-shadow: 0 4px 14px rgba(200, 121, 30, .14);
}
.resume-bar.off {
  background: #f2f2f7;
  border-color: var(--line);
  box-shadow: none;
}
.resume-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 14px;
  min-width: 0;
}
.resume-icon { font-size: 20px; }
.resume-text {
  font-weight: 600;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.resume-count { color: var(--gold); font-size: 12px; font-weight: 700; }
.resume-bar.off .resume-count { color: var(--muted); font-weight: 400; }
.resume-actions { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.resume-auto {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 9px;
  cursor: pointer;
  user-select: none;
}
.resume-auto input { accent-color: var(--gold); cursor: pointer; }
.resume-x { color: var(--muted); padding: 5px 8px; }

/* ---------- 正在进行的游戏桌 ---------- */

.active-tables {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
  box-shadow: 0 2px 8px var(--shadow-tint);
}
.at-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.at-title { font-size: 15px; font-weight: 800; color: var(--brand-dark); margin-bottom: 8px; }
.at-head .at-title { margin-bottom: 0; }
.at-list { display: flex; flex-direction: column; gap: 6px; }
.at-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--brand-soft2);
}
.at-row.off { opacity: .65; }
.at-headline { display: flex; align-items: center; gap: 6px; min-width: 0; flex: none; }
.at-icon { font-size: 18px; flex: none; }
.at-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.at-name {
  font-weight: 700;
  font-size: 14px;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.at-room { font-size: 12px; color: var(--muted); }
.at-dur { color: var(--gold); font-weight: 700; }
.at-players { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 3px; }
.at-player {
  font-size: 12px;
  color: var(--muted);
  background: var(--soft-neutral);
  border-radius: 7px;
  padding: 2px 7px;
  white-space: nowrap;
}
.at-player.on { color: var(--green); background: var(--green-soft); }
.at-player.off { color: var(--muted); background: var(--soft-neutral); }
.at-player.bot { color: var(--muted); background: var(--soft-neutral2); }
.at-player-muted { font-size: 11px; color: var(--muted); }
.at-btns { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.at-enter { flex: none; text-decoration: none; }
.at-abandon { color: var(--gold); }
.at-destroy { color: var(--red); }

/* ---------- 手机端：继续上一局 / 正在进行的游戏桌 和谐排版 ---------- */
@media (max-width: 640px) {
  .hero-brand { display: flex; gap: 8px; min-height: 70px; }
  .hero-brand-mark { width: 54px; height: 50px; transform: translateY(-4px); }
  .hero-brand-mark:hover { transform: translateY(-4px); }
  .hero-brand-copy { text-align: left; }
  .hero-title { font-size: 22px; line-height: 1.18; }
  .hero-sub { margin: 4px 0 8px; white-space: nowrap; }

  /* 继续上一局：第一行 图标+标题（超长省略），第二行提示，第三行按钮靠右 */
  .resume-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 10px 12px;
    margin-bottom: 12px;
  }
  .resume-icon { font-size: 18px; flex: none; }
  .resume-text { font-size: 13px; }
  .resume-count {
    width: 100%;
    order: 10;
    font-size: 11px;
    font-weight: 400;
    color: var(--muted);
  }
  .resume-actions { justify-content: flex-end; gap: 6px; }
  .resume-actions .btn { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
  .resume-auto { font-size: 11px; padding: 4px 8px; }

  /* 正在进行的游戏桌：标题行 + 每桌一张小卡片 */
  .active-tables { padding: 10px 10px 12px; margin-bottom: 12px; }
  .at-head {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin-bottom: 8px;
  }
  .at-head .btn { align-self: flex-end; }
  .at-title { font-size: 14px; }
  .at-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 10px;
    border-radius: 12px;
  }
  .at-headline { width: 100%; }
  .at-icon { font-size: 18px; }
  .at-info { width: 100%; }
  .at-room { font-size: 11px; line-height: 1.5; }
  .at-players { gap: 4px 6px; margin-top: 4px; }
  .at-player { font-size: 11px; padding: 2px 7px; }
  .at-btns {
    justify-content: flex-end;
    gap: 6px;
    padding-top: 6px;
    border-top: 1px dashed var(--line);
    width: 100%;
  }
  .at-btns .btn { padding: 4px 10px; font-size: 12px; border-radius: 8px; }
}

.hub-link-box {
  background: var(--brand-soft);
  border: 1px dashed var(--brand-line);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.hub-link-title { font-weight: 700; color: var(--brand-dark); font-size: 14px; margin-bottom: 6px; }
.hub-link-text {
  word-break: break-all;
  font-size: 14px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 8px;
}

/* ---------- 分类 / 卡片 ---------- */

.groups { display: flex; flex-direction: column; gap: 14px; }

.group-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--brand-dark);
  margin-bottom: 8px;
  padding-left: 4px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.game-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 2px 8px var(--shadow-tint);
  transition: box-shadow .15s ease;
}
.game-card.just-updated { animation: flash 1.4s ease; }

@keyframes flash {
  0% { box-shadow: 0 0 0 3px var(--shadow-flash); background: var(--brand-soft); }
  100% { box-shadow: 0 2px 8px var(--shadow-tint); }
}

.gc-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.gc-icon { font-size: 26px; }
.gc-icon-btn {
  border: none;
  background: transparent;
  padding: 2px;
  margin: -2px;
  cursor: pointer;
  color: inherit;
  border-radius: 8px;
  line-height: 1;
  transition: transform .12s ease, background .12s ease;
}
.gc-icon-btn:hover { transform: scale(1.12); background: var(--brand-soft); }
.gc-icon-btn:active { transform: scale(.94); }
.gc-name { font-weight: 800; font-size: 16px; flex: 1; }
.gc-name-btn {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  font-family: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gc-name-btn:hover { text-decoration: underline; }
.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ccc;
  display: inline-block;
}
.status-dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(46,139,87,.18); }
.status-dot.off { background: #c9c3d8; }
.gc-status { font-size: 12px; color: var(--muted); }
.gc-ctrl {
  flex: none;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 2px 6px rgba(60, 50, 160, .10);
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}
.gc-ctrl:hover:not(:disabled) {
  transform: translateY(-1px) scale(1.06);
  box-shadow: 0 5px 14px var(--shadow-ctrl);
  background: var(--brand-soft);
  border-color: #c9bff0;
}
.gc-ctrl:active:not(:disabled) { transform: scale(.94); }
.gc-ctrl:disabled { opacity: .5; cursor: wait; transform: none; box-shadow: none; }

.gc-link-wrap {
  background: var(--brand-soft2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 8px;
}
.gc-link {
  word-break: break-all;
  font-size: 13px;
  color: var(--brand-dark);
  text-decoration: none;
  display: block;
  line-height: 1.5;
}
.gc-link:hover { text-decoration: underline; }
.gc-link.offline { color: var(--muted); }
.gc-link.stale {
  color: var(--muted);
  text-decoration: line-through;
  cursor: not-allowed;
}
.gc-empty.stale-tip { color: #b3402a; }
.gc-empty { color: var(--muted); font-size: 13px; }

.gc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.gc-updated { font-size: 12px; color: var(--muted); }
.gc-online-time {
  display: none;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- 说明 ---------- */

.tips { font-size: 13px; margin-top: 12px; }
.tips summary { cursor: pointer; font-weight: 700; color: var(--brand-dark); margin-bottom: 6px; }
.tips ul { margin-left: 18px; line-height: 1.8; color: var(--ink); }

.tips-stats { margin-top: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tips-stats .btn { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-dark); }
.tips-stats .btn:hover:not(:disabled) { background: var(--brand-soft-hover); }

/* 各游戏实时数据：整块面板与页面同宽，点击按钮后从下方展开 */
.stats-table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
  box-shadow: 0 2px 8px var(--shadow-tint);
  width: 100%;
}
.stats-hint { font-size: 11px; color: var(--muted); margin-bottom: 8px; line-height: 1.6; }
.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.stats-table th,
.stats-table td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
.stats-table thead th {
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 700;
}
.stats-table tbody tr:nth-child(even) { background: var(--brand-soft2); }
.stats-table tbody tr:hover { background: var(--brand-soft); }
.stats-table .st-num { text-align: center; }
.stats-table .st-status { white-space: nowrap; }

/* 在线人数可点击展开 */
.st-pbtn {
  border: 1px solid var(--brand-line);
  background: var(--brand-soft);
  color: var(--brand-dark);
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}
.st-pbtn:hover:not(:disabled) { background: var(--brand-soft-hover); }
.st-pbtn.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* 合计行：在线人数 / 在线桌数 / 今日 / 近七日 / 近一月 总数 */
.stats-total-row td {
  background: var(--brand-soft) !important;
  font-weight: 700;
  color: var(--brand-dark);
  border-top: 2px solid var(--brand-line);
}
.stats-total-row .total-label { font-weight: 800; }

/* 在线玩家弹窗 */
.online-card { max-width: 640px; }
.stats-fold { font-size: 12px; }
.stats-fold-title { font-weight: 700; color: var(--brand-dark); margin: 8px 0 5px; }
.sp-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.sp-chip {
  background: var(--green-soft);
  color: var(--green-ink);
  border-radius: 8px;
  padding: 2px 9px;
  font-size: 12px;
}
.sp-empty { color: var(--muted); font-size: 12px; padding: 4px 2px; }
.sp-list { display: flex; flex-direction: column; gap: 4px; }
.sp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 8px;
  background: var(--panel);
}
.sp-name {
  border: none;
  background: transparent;
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
}
.sp-name:hover { background: var(--brand-soft); }
.sp-name.on { color: var(--brand-dark); }
.sp-room { color: var(--muted); font-size: 12px; }
.sp-no-uid { color: var(--gold); font-size: 11px; }
.sp-detail {
  margin: 4px 0 4px 8px;
  padding: 6px 8px;
  border-left: 2px solid var(--brand-line);
  width: 100%;
}
.sp-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.sp-table th,
.sp-table td { padding: 4px 8px; text-align: left; border-bottom: 1px solid var(--line-soft); }
.sp-table thead th { background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; }
.sp-table .st-num { text-align: center; }
.sp-interval { white-space: nowrap; font-weight: 600; }
.sp-gname { font-weight: 600; }

/* ---------- 反馈入口 ---------- */

.report-panel { margin-top: 12px; }
.report-panel .panel-title,
.report-panel .sub-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--brand-dark);
  margin-bottom: 6px;
}
.mail-status { font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.report-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 720px) {
  .report-grid { grid-template-columns: 1fr; }
}

.report-form-box {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 8px;
  background: var(--brand-soft2);
  box-shadow: 0 1px 4px var(--shadow-tint);
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.rf-title { font-weight: 600; color: var(--brand-dark); font-size: 11px; letter-spacing: .2px; }
.rf-input, .rf-textarea {
  width: 100%;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.5;
  background: var(--panel);
  font-family: inherit;
}
.rf-textarea { min-height: 44px; resize: vertical; }
.report-form-box .btn { padding: 5px 10px; font-size: 12px; align-self: flex-start; }

/* ---------- 分类管理（站长） ---------- */

.cats-card { max-width: 720px; }
.reports-card { max-width: 760px; }
.reports-hint { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.reports-body { display: flex; flex-direction: column; gap: 10px; max-height: 65vh; overflow-y: auto; }
.report-detail-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--panel-soft);
}
.report-detail-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.report-detail-title { flex: 1; font-weight: 700; font-size: 13px; }
.report-detail-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.report-detail-meta span { font-size: 11px; color: var(--muted); }
.report-detail-desc {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--panel);
  border-radius: 8px;
  padding: 6px 8px;
}

/* ---------- 用户统计（站长） ---------- */

.users-card { max-width: 780px; }
.users-hint { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.users-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.users-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 6px;
  background: var(--panel-soft);
  cursor: pointer;
  text-align: center;
}
.users-card:hover { background: var(--brand-soft); }
.users-card.on { border-color: var(--brand); background: var(--brand-soft); }
.users-card-num {
  display: block;
  font-size: 20px;
  font-weight: 800;
  color: var(--brand-dark);
  line-height: 1.2;
}
.users-card-label { font-size: 12px; color: var(--muted); }
.users-tab-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.users-tab {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
}
.users-tab:hover { background: var(--brand-soft); }
.users-tab.on {
  border-color: var(--brand);
  color: var(--brand-dark);
  background: var(--brand-soft);
  font-weight: 700;
}
.users-body {
  max-height: 58vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.users-list { display: flex; flex-direction: column; gap: 5px; }
.users-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 5px 9px;
  background: var(--panel-soft);
}
.users-name {
  border: none;
  background: transparent;
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 6px;
}
.users-name:hover { background: var(--brand-soft); }
.users-account {
  font-size: 10px;
  color: var(--green-ink);
  background: var(--green-soft);
  border-radius: 999px;
  padding: 1px 7px;
}
.users-meta { color: var(--muted); font-size: 11px; }
.user-detail-card { max-width: 720px; }
.user-detail-info { margin-bottom: 10px; }
.user-info-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--panel-soft);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.user-info-row { font-size: 12px; color: var(--ink); }
.user-history-head {
  font-weight: 700;
  color: var(--brand-dark);
  font-size: 13px;
  margin: 8px 0 5px;
}
.user-history-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.user-history-table th,
.user-history-table td {
  padding: 4px 8px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
}
.user-history-table thead th { background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; }
.uh-time { white-space: nowrap; }
.uh-result.win { color: var(--green-ink); font-weight: 700; }
.uh-note { color: var(--muted); }
.user-detail-history { max-height: 55vh; overflow-y: auto; }

.cats-hint { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.cats-add-row { display: flex; gap: 8px; margin-bottom: 12px; }
.cats-add-row .rf-input { flex: 1; }
.cats-search-row { display: flex; align-items: center; gap: 8px; margin: -2px 0 12px; }
.cats-search-label { color: var(--brand-dark); font-size: 12px; font-weight: 700; white-space: nowrap; }
.cats-search-row .rf-input { flex: 1; min-width: 0; }
.cats-search-count { color: var(--muted); font-size: 11px; white-space: nowrap; }
.cat-manage-section {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 10px;
  background: var(--panel-soft);
}
.cat-manage-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cat-manage-icon { font-size: 16px; }
.cat-manage-name { font-weight: 700; font-size: 14px; min-width: 64px; }
.cat-order-btns { display: inline-flex; flex-direction: column; gap: 1px; }
.cat-order-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--brand);
  border-radius: 5px;
  font-size: 9px;
  line-height: 1;
  padding: 3px 5px;
  cursor: pointer;
}
.cat-order-btn:hover:not(:disabled) { background: var(--brand-soft); }
.cat-order-btn:disabled { opacity: .35; cursor: not-allowed; }
.cat-rename-input { flex: 1; min-width: 120px; max-width: 220px; }
.cat-del { color: var(--red); }
.cat-manage-empty { color: var(--muted); font-size: 12px; padding: 6px 2px; }
.cat-manage-games { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.cat-manage-game {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
  padding: 3px 4px;
  border-top: 1px dashed var(--line);
}
.cat-manage-game-icon { font-size: 14px; }
.cat-manage-game-name { flex: 1; }
.cat-move-select {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 3px 6px;
  font-size: 12px;
  font-family: inherit;
  max-width: 180px;
  color: var(--ink);
  background: var(--panel);
}
.cat-manage-game.hidden-game { opacity: .72; }
.cat-manage-game.hidden-game .cat-manage-game-name { text-decoration: line-through; }
.cat-manage-hidden-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--red);
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0 6px;
  margin-left: 6px;
  vertical-align: 1px;
}
.cat-hide-btn.on { color: var(--green); }
.cat-game-order-btns { flex-direction: row; gap: 2px; margin-right: 2px; }

@media (max-width: 640px) {
  .cats-search-row { align-items: stretch; flex-wrap: wrap; }
  .cats-search-label { align-self: center; }
  .cats-search-count { align-self: center; }
  /* 手机端：三个按钮竖排，行间距收拢为正常间距 */
  .toolbar { flex-direction: column; gap: 8px; }
  /* 手机端：一行两个小卡片，隐藏端口/更新时间等次要信息 */
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .game-card { padding: 10px; border-radius: 12px; }
  .gc-head { gap: 6px; margin-bottom: 6px; }
  .gc-icon { font-size: 20px; }
  .gc-name { font-size: 14px; }
  .gc-status-text { display: none; }
  .gc-link-wrap { padding: 6px 8px; margin-bottom: 6px; border-radius: 8px; }
  .gc-link {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .gc-empty { font-size: 11px; line-height: 1.4; }
  .gc-updated { display: none; }
  /* 左下：上次服务器重启时间（仅 时:分:秒） */
  .gc-online-time {
    display: inline-block;
    visibility: hidden;
  }
  .gc-online-time.visible { visibility: visible; }
  .gc-foot { justify-content: space-between; }
  .gc-btns { gap: 4px; }
  .gc-btns .btn {
    padding: 3px 5px;
    font-size: 12px;
    border-radius: 7px;
    height: 28px;
    min-width: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
  }
  .search-panel { padding: 10px; }
  .stats-table-wrap { padding: 8px; overflow-x: auto; }
  #stats-table-wrap .stats-table { min-width: 600px; }
  .sp-detail { margin-left: 2px; }
}

/* =========================================================
 * 站长工具 · 编辑页面（✏️）
 * 编辑模式下：静态文字可点击修改，动态数据区域保持不可编辑；
 * 顶部固定工具栏提供字号 / 颜色 / 对齐 / 字体 / 加粗 / 斜体 /
 * 下划线 / 删除线等格式。
 * ========================================================= */

#page-edit-toolbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2147483000;
  background: linear-gradient(180deg, #232a4d, #1b2140);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
  padding: 8px 10px 10px;
  font-size: 14px;
}
#page-edit-toolbar.hidden { display: none; }
.pet-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  max-width: 1100px;
  margin: 0 auto;
}
#page-edit-toolbar button {
  background: #31396b;
  color: #fff;
  border: 1px solid #4b5699;
  border-radius: 6px;
  padding: 4px 9px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.4;
}
#page-edit-toolbar button:hover { background: #414b8a; }
#page-edit-toolbar button.active {
  background: #7a6bff;
  border-color: #a99bff;
  box-shadow: 0 0 0 2px rgba(122, 107, 255, 0.35);
}
#page-edit-toolbar .pet-b { font-weight: 800; }
#page-edit-toolbar .pet-i { font-style: italic; }
#page-edit-toolbar .pet-u { text-decoration: underline; }
#page-edit-toolbar .pet-s { text-decoration: line-through; }
#page-edit-toolbar .pet-a-sm { font-size: 11px !important; font-weight: 700; }
#page-edit-toolbar .pet-a-lg { font-size: 16px !important; font-weight: 800; }
.pet-opacity {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #c9cff2;
  font-size: 12px;
}
.pet-opacity input[type="range"] { width: 64px; height: 20px; padding: 0; }
.pet-area {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #c9cff2;
  font-size: 12px;
  background: #2a3160;
  border: 1px solid #4b5699;
  border-radius: 7px;
  padding: 3px 8px;
}
.pet-area.hidden { display: none; }
.pet-area input[type="color"] { width: 30px; height: 24px; padding: 1px; }
.pet-area input[type="range"] { width: 58px; height: 20px; padding: 0; }
body.page-editing .pet-area-target {
  outline: 2px solid rgba(122, 107, 255, 0.9) !important;
  outline-offset: 2px;
  border-radius: 8px;
}
#page-edit-toolbar select,
#page-edit-toolbar input[type="color"] {
  background: #31396b;
  color: #fff;
  border: 1px solid #4b5699;
  border-radius: 6px;
  padding: 4px;
  height: 30px;
  max-width: 130px;
}
#page-edit-toolbar select option { color: #fff; background: #31396b; }
#page-edit-toolbar input[type="color"] { width: 38px; padding: 2px; cursor: pointer; }
.pet-sep { width: 1px; height: 20px; background: #4b5699; margin: 0 2px; }
.pet-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  max-width: 1100px;
  margin: 8px auto 0;
}
.pet-hint { color: #c9cff2; font-size: 12px; margin-right: auto; }
#page-edit-toolbar .pet-btn { padding: 5px 12px; border-radius: 7px; }
#page-edit-toolbar .pet-primary {
  background: #5b4bd6 !important;
  border-color: #7a6bff !important;
  font-weight: 700;
}
#page-edit-toolbar .pet-danger {
  background: #8b2f3f !important;
  border-color: #b34a5e !important;
}

body.page-editing { padding-top: 112px; }

body.page-editing [contenteditable="true"] {
  outline: 1px dashed rgba(122, 107, 255, 0.75);
  outline-offset: 2px;
  border-radius: 4px;
  cursor: text;
  transition: background 0.15s;
}
body.page-editing [contenteditable="true"]:hover {
  outline-style: solid;
  background: rgba(122, 107, 255, 0.07);
}
body.page-editing [contenteditable="true"]:focus {
  outline-style: solid;
  background: rgba(122, 107, 255, 0.12);
  box-shadow: 0 0 0 2px rgba(122, 107, 255, 0.25);
}
body.page-editing input:not(#page-edit-toolbar input),
body.page-editing textarea,
body.page-editing select:not(#page-edit-toolbar select),
body.page-editing label {
  pointer-events: none;
}
body.page-editing .tips summary { pointer-events: auto; }

@media (max-width: 640px) {
  #page-edit-toolbar { padding: 6px; font-size: 13px; }
  .pet-main { gap: 4px; }
  #page-edit-toolbar button { padding: 3px 7px; font-size: 13px; }
  #page-edit-toolbar select,
  #page-edit-toolbar input[type="color"] { height: 28px; max-width: 100px; }
  .pet-foot { justify-content: flex-end; }
  .pet-hint { width: 100%; margin-right: 0; }
  body.page-editing { padding-top: 158px; }
}

/* =========================================================
 * 夜间模式可读性增强
 * 手机/系统开启夜间模式时：
 * - 声明 color-scheme: dark，避免浏览器自动反色，原生控件按暗色渲染；
 * - 页面偏暗时微调主题变量（背景/面板/分隔线/次要文字）变亮，
 *   并叠一层 5% 的提亮层，让暗色界面更清晰可读。
 * 类名由 public/night-readability.js 自动添加/移除。
 * ========================================================= */
html.ghf-night-readable { color-scheme: dark; }

.ghf-night-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  pointer-events: none;
  mix-blend-mode: screen;
  background: rgba(255, 255, 255, .05);
}

html.ghf-night-readable-dark .ghf-night-overlay { display: block; }

.avatar-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #f2f1f8;
  border: 1px solid #ddd;
  font-size: 26px;
  overflow: hidden;
  flex: none;
}
.avatar-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.avatar-icon-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  margin-top: 8px;
}
.avatar-icon-btn {
  font-size: 22px;
  line-height: 1;
  padding: 6px 0;
  background: #f6f6fa;
  border: 1px solid #e4e2ef;
  border-radius: 10px;
  cursor: pointer;
}
.avatar-icon-btn:hover { background: #fff3d8; border-color: #ffc966; }
.avatar-icon-btn.active { background: #ffe9bd; border-color: #f0a93b; }

.profile-card { max-height: 84vh; overflow-y: auto; }
.auth-input { display: block; width: 100%; box-sizing: border-box; margin-bottom: 8px; }
.btn-block { display: block; width: 100%; box-sizing: border-box; margin-top: 2px; }
.auth-links { display: flex; justify-content: center; align-items: center; gap: 8px; margin: 10px 0 4px; font-size: 13px; }
.auth-links a { color: var(--brand, #6b4de0); text-decoration: none; cursor: pointer; }
.auth-sep { color: #bbb; }
.auth-sub-box { margin-top: 4px; }
.auth-back { display: inline-block; margin-top: 10px; font-size: 13px; color: #888; text-decoration: none; cursor: pointer; }
.profile-collapse-head { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 2px; cursor: pointer; user-select: none; background: none; border: 0; font: inherit; text-align: left; }
.profile-collapse-head .profile-label { flex: 1; margin: 0; }
#modal-profile button,
#modal-profile label,
.profile-collapse-head {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
.profile-collapse-head:focus,
.profile-collapse-head .btn:focus,
.profile-collapse-head .collapse-arrow:focus {
  outline: none;
}
.collapse-arrow { font-size: 16px; color: #999; line-height: 1; transition: transform .15s ease; }
.profile-collapse-head.open .collapse-arrow { transform: rotate(180deg); }
.profile-collapse-body { padding-top: 4px; }
.collapse-hint {
  font-size: 12px;
  color: var(--brand, #6b4de0);
  background: rgba(107, 77, 224, .08);
  border: 1px solid rgba(107, 77, 224, .25);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
  flex: none;
}
.profile-card .profile-collapse-head .fav-tools .btn {
  height: 26px;
  font-size: 12px;
  padding: 0 10px;
}

.profile-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}
.profile-grid-2.logged { grid-template-columns: 1fr; }
.profile-grid-2 .profile-block { margin: 0; }
.profile-grid-2 .rf-input { height: 32px; font-size: 13px; padding: 0 10px; }
.profile-grid-2 .btn { height: 32px; padding: 0 12px; font-size: 13px; }
.profile-grid-2 .profile-label { font-size: 12px; margin-bottom: 6px; }
.profile-grid-2 .profile-hint { font-size: 11px; margin-top: 4px; }
@media (max-width: 560px) {
  .profile-grid-2 { grid-template-columns: 1fr; }
}

/* 个人中心统一尺寸：输入框 / 按钮 / 行距 */
.profile-card .profile-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.profile-card .rf-input,
.profile-card .auth-input {
  display: block;
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  font-size: 14px;
  border: 1px solid #d8d6e4;
  border-radius: 10px;
  background: #fff;
  box-sizing: border-box;
  outline: none;
}
.profile-card .rf-input:focus,
.profile-card .auth-input:focus {
  border-color: var(--brand, #6b4de0);
  box-shadow: 0 0 0 2px rgba(107, 77, 224, .12);
}
.profile-card .profile-row .rf-input { flex: 1 1 140px; }
.profile-card .auth-input { margin-bottom: 8px; }
.profile-card .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 16px;
  font-size: 14px;
  border-radius: 10px;
  box-sizing: border-box;
  line-height: 1;
  white-space: nowrap;
}
.profile-card .btn.sm { height: 34px; padding: 0 10px; font-size: 13px; }
.profile-card .btn-block { width: 100%; }
.profile-card .profile-block { padding: 12px; }
.profile-card .profile-label { font-size: 13px; margin-bottom: 8px; }
.profile-card .profile-hint { font-size: 12px; color: #8a86a8; margin-top: 6px; line-height: 1.5; }
.profile-card .profile-collapse-head { min-height: 42px; }
.profile-card .fav-tools { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* 登录后：账号信息缩到右下角，不显眼 */
.auth-logged-mini {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px 4px;
  font-size: 12px;
  color: #999;
}
.auth-logged-mini .auth-mini-line { color: #888; }
.auth-logged-mini .auth-bind-input { width: 170px; height: 30px; font-size: 12px; padding: 0 8px; }
.auth-logged-mini .btn { height: 24px; font-size: 11px; padding: 0 8px; }

/* 历史统计表格：桌面端保持表格，手机端转成紧凑卡片 */
.profile-card .stats-table { width: 100%; border-collapse: collapse; }
.profile-card .stats-table th,
.profile-card .stats-table td { padding: 6px 8px; font-size: 13px; text-align: right; white-space: nowrap; }
.profile-card .stats-table th { text-align: center; color: #888; font-weight: 600; border-bottom: 1px solid #eee; }
.profile-card .stats-table td.st-game { text-align: left; font-weight: 600; }
@media (max-width: 560px) {
  /* 手机端历史统计：保留表头、压缩间距，四列一屏放下，不再需要横滑 */
  .profile-card .stats-table { table-layout: fixed; min-width: 0; }
  .profile-card .stats-table th,
  .profile-card .stats-table td {
    padding: 5px 2px;
    font-size: 12px;
    white-space: nowrap;
  }
  .profile-card .stats-table th:first-child,
  .profile-card .stats-table td:first-child {
    width: 42%;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .profile-card .stats-table th:not(:first-child) { width: 19.3%; }
}
