:root {
  --bg: linear-gradient(150deg, #e9ecf6 0%, #edeaf7 40%, #e7f2ef 70%, #eceff8 100%);
  --bg-solid: #eaedf6;
  --fg: #1b2333;
  --muted: #5c6a82;
  --tile-top: rgba(255, 255, 255, .55);     /* 磁贴顶面受光 */
  --tile-bottom: rgba(255, 255, 255, .16);  /* 磁贴底面（渐隐到父卡片） */
  --tile-edge: rgba(255, 255, 255, .55);    /* 磁贴顶边亮线 */
  --tile-shadow: rgba(10, 16, 30, .14);     /* 磁贴投影 */
  --tile-text: #42506a;                     /* 磁贴说明文字，比 --muted 再沉一点，压在玻璃上更清楚 */
  --panel: rgba(255, 255, 255, 0.05);
  --panel-2: rgba(255, 255, 255, 0.03);
  --panel-solid: #ffffff;
  --line: rgba(20, 30, 55, 0.10);
  --line-strong: rgba(20, 30, 55, 0.16);
  --accent: #4d7cff;
  --accent-2: #3562e6;
  --ok: #22a06b;
  --err: #d64545;
  --shadow: 0 12px 36px rgba(30, 42, 70, 0.12);
  --blob-a: rgba(110, 148, 235, 0.24);
  --blob-b: rgba(150, 122, 235, 0.20);
  --blob-c: rgba(84, 200, 184, 0.18);
  --radius: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg-solid: #0a0e18;
    --bg: linear-gradient(146deg, #050814 0%, #0b0722 40%, #02120f 72%, #060a15 100%);
    --fg: #eef2fb;
    --muted: #8d97ad;
    --tile-top: rgba(255, 255, 255, .10);
    --tile-bottom: rgba(255, 255, 255, .02);
    --tile-edge: rgba(255, 255, 255, .20);
    --tile-shadow: rgba(0, 0, 0, .34);
    --tile-text: #c6d0e2;
    --panel: rgba(255, 255, 255, 0.030);
    --panel-2: rgba(255, 255, 255, 0.018);
    --panel-solid: #131927;
    --line: rgba(255, 255, 255, 0.12);
    --line-strong: rgba(255, 255, 255, 0.20);
    --accent: #6d9bff;
    --accent-2: #4d7cff;
    --ok: #35c07f;
    --err: #ff6b6b;
    --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    --blob-a: rgba(80, 126, 255, 0.44);
    --blob-b: rgba(146, 84, 255, 0.38);
    --blob-c: rgba(36, 208, 182, 0.32);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
/*
 * hidden 属性必须压过组件自己的 display。
 * 浏览器默认的 [hidden]{display:none} 优先级低于任何类选择器，
 * 所以 .dot-badge / .back 之类写了 display:flex 后，el.hidden = true 会失效。
 */
[hidden] { display: none !important; }
/* 画布底色。光斑不画在 html/body 的 background 上：那两块只铺到"自己的盒子"，
   盒子结束的地方就只剩这个纯色 —— 页面上是一条横贯的硬直线，光斑被齐刷刷切断。
   （body 盒子比可视区短、或浏览器只铺一屏时就会出现，内容越长越容易撞上。）
   现在光斑在下面 body::before 那层"固定整屏"的元素里，跟内容高度彻底无关。 */
html { height: 100%; background-color: var(--bg-solid, #0a0e18); }
/* 手机上任何一点点溢出都会变成"可以左右拖"，这里在根上裁掉 x 方向的溢出。
   用 clip 而不是 hidden：clip 不会创建滚动容器，粘性定位（侧栏）照常工作。 */
html, body { max-width: 100%; overflow-x: clip; }
/* 只允许上下拖：横向手势不响应（纵向滚动和双指缩放保留）。
   之前手机上有"左右能拖一点"的手感，就是这层没收住。 */
body { touch-action: pan-y pinch-zoom; }
body {
  margin: 0; min-height: 100%; color: var(--fg);
  font: 15px/1.65 -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
body.busy { cursor: progress; }
/* 彩色光斑：固定一屏的一层，永远铺满可视区，内容多高都不影响，滚动也不重排。
   没有 filter/blur，所以不会被按视口切成几块栅格化（旧版那两层"固定 + 80px 模糊"就是这么切出硬边的）。
   渐变本身就是软的，不需要 blur。 */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-color: var(--bg-solid, #0a0e18);
  background-image:
    radial-gradient(58% 46% at 12% 10%, var(--blob-a), transparent 66%),
    radial-gradient(52% 40% at 86% 16%, var(--blob-c), transparent 62%),
    radial-gradient(56% 44% at 78% 74%, var(--blob-b), transparent 64%),
    radial-gradient(50% 40% at 24% 88%, var(--blob-c), transparent 66%),
    var(--bg);
  background-repeat: no-repeat;
}

/*
 * 网页背景水印：不夜城 logo（内联 SVG，见 index.html 的 #city-mark）。
 * 夹在两层彩色光斑之间——固定全屏、不吃点击、颜色跟随 --fg，
 * 所以浅色模式是淡淡一层墨色、深色模式是淡淡一层白，都不用单独出图。
 */
.page-watermark {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(460px, 58vw); height: auto;
  /* 外层 <svg> 没有 viewBox（写了两层 viewBox 会裁掉月牙外弧），比例在这里定 */
  aspect-ratio: 683 / 927;       /* 新 logo（月牙+星芒+城市）是竖版 */
  z-index: -1; pointer-events: none;
  color: var(--fg); fill: currentColor; opacity: .09;
}
@media (prefers-color-scheme: dark) { .page-watermark { opacity: .15; } }

/* 内联 SVG 本体：颜色统一交给 CSS 的 currentColor，形状由 <symbol> 定义、各处以 <use> 复用。
   aspect-ratio 是必须的 —— 外层 <svg> 不能写 viewBox（会和 <symbol> 的 viewBox 打架、裁掉月牙外弧），
   没有 viewBox 就没有内在比例，比例只能由这里给。 */
.city-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.city-logo { display: block; color: var(--fg); fill: currentColor; aspect-ratio: 683 / 927; }

a { color: var(--accent); text-decoration: none; }
h1 { font-size: 24px; margin: 0; letter-spacing: .01em; }
h2 { font-size: 16px; margin: 0 0 14px; }
h3 { font-size: 15px; margin: 0 0 6px; }

/* 玻璃表面 */
header, .card, dialog, .tile, .land, .hero {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

header {
  display: flex; align-items: center; gap: 12px; padding: 10px 20px;
  border-radius: 0 0 var(--radius) var(--radius);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: baseline; gap: 8px; color: var(--fg); }
.brand .mark { font-weight: 800; letter-spacing: .05em; font-size: 18px; }
.brand .sub { color: var(--muted); font-size: 13px; }
/* 登录首页：正门外那块标 */
.login-logo { width: 168px; height: auto; margin-bottom: 16px; }
@media (max-width: 560px) { .login-logo { width: 124px; } }
.brand-mark {
  width: 26px; height: 26px; flex: none; color: var(--fg); fill: currentColor;
  aspect-ratio: 683 / 927;           /* 和 symbol 的 viewBox 一致，避免拉伸 */
}
.brand { display: inline-flex; align-items: center; gap: 9px; }
.identity {
  margin-left: auto; color: var(--muted); font-size: 13px;
  /* 顶栏里「名字 · 身份」本身就是个人主页入口：头像太小、玩家根本不知道能点 */
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 10px 5px 12px; border-radius: 11px; text-decoration: none;
  border: 1px solid transparent;
  transition: color .22s, background-color .22s, border-color .22s;
}
.identity:hover, .identity:focus-visible {
  color: var(--fg); border-color: var(--line-strong);
  background-color: color-mix(in srgb, var(--fg) 6%, transparent);
  text-decoration: none;
}
.identity-text { white-space: nowrap; }
.identity-link {
  font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.identity-chevron { opacity: .55; flex: none; }
.identity:hover .identity-chevron { opacity: 1; }
@media (max-width: 640px) { .identity-link { display: none; } }   /* 窄屏只留名字 + 箭头 */


/* 正文 + 工作台侧边栏：没有侧边栏时就是原来那个居中 1080 的版心 */
#layout {
  display: grid; grid-template-columns: minmax(0, 1fr); max-width: 1120px; margin: 0 auto; padding: 0 20px; align-items: start;
  /* 收起 / 展开工作台时列宽平滑过渡，别瞬间跳 */
  transition: grid-template-columns .46s cubic-bezier(.22, 1, .36, 1);
}
#layout.has-sidebar { max-width: 1420px; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; }
main { min-width: 0; padding: 28px 0 72px; }
#sidebar { position: sticky; top: 78px; margin: 28px 0 18px; }
#sidebar .grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
/* 宽屏下侧栏最多占一屏，磁贴多了在「工作台」内部自己滚（带一条细滑条），
   不然 sticky 的侧栏比视口高时，下面的磁贴永远够不着。 */
@media (min-width: 1101px) {
  #sidebar {
    max-height: calc(100vh - 124px); display: flex; flex-direction: column; overflow: hidden;
  }
  #sidebar .side-head { flex: none; }
  #sidebar .side-more {
    flex: none; text-align: center; font-size: 12px; color: var(--muted); padding: 8px 0 2px;
  }
  #sidebar .side-body {
    flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-right: 2px;
    scrollbar-gutter: stable;
    scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--fg) 24%, transparent) transparent;
  }
  #sidebar .side-body::-webkit-scrollbar { width: 6px; }
  #sidebar .side-body::-webkit-scrollbar-track { background: transparent; }
  #sidebar .side-body::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--fg) 22%, transparent); border-radius: 999px;
  }
  #sidebar .side-body::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--fg) 34%, transparent); }
}
/* 工作台可收起到侧边：收起后只剩一条竖条，点一下再展开（状态记在 localStorage） */
.side-head { display: flex; align-items: flex-start; gap: 8px; }
.side-head h2 { flex: 1; margin: 0 0 14px; }
.side-toggle {
  flex: none; width: 26px; height: 26px; padding: 0; margin-bottom: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px; line-height: 1; font-size: 15px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); box-shadow: none;
}
.side-toggle:hover { color: var(--fg); border-color: var(--accent); }
.side-rail { display: none; }
#sidebar.collapsed { padding: 12px 6px; }
#sidebar.collapsed .side-head, #sidebar.collapsed .side-body { display: none; }
#sidebar.collapsed .side-rail {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  width: 100%; padding: 10px 0; border: none; box-shadow: none;
  background: none; color: var(--muted);
}
#sidebar.collapsed .side-rail:hover { color: var(--fg); }
.side-rail-text { writing-mode: vertical-rl; letter-spacing: .25em; font-size: 13px; }
/* 工作台出场：磁贴依次上滑淡入；收起后的竖条轻微右侧滑入 */
#sidebar.side-enter .side-body .tile {
  /* backwards 而不是 both：动画结束后不再保留 opacity/transform，
     否则元素会一直被当成合成层，backdrop-filter 的磨砂会掉（表现就是"一动就变回旧样式"）。 */
  animation: rise-in .72s cubic-bezier(.22, 1, .36, 1) backwards;
  animation-delay: var(--rise, 0ms);
}
#sidebar.collapsed .side-rail { animation: side-in .42s cubic-bezier(.22, 1, .36, 1) both; }
@keyframes side-in {
  from { opacity: 0; transform: translateX(8px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  #layout { transition: none; }
  #sidebar.side-enter .side-body .tile, #sidebar.collapsed .side-rail { animation: none; }
}
@media (min-width: 1101px) {
  #layout.has-sidebar.sidebar-collapsed { grid-template-columns: minmax(0, 1fr) 52px; gap: 14px; }
}
@media (max-width: 1100px) {
  /* 窄屏是上下堆叠，收起后的竖条改成横条 */
  .side-rail { flex-direction: row !important; justify-content: center; gap: 8px !important; }
  .side-rail-text { writing-mode: horizontal-tb !important; letter-spacing: normal !important; }
}
/* 窄屏放不下两栏，侧边栏整行落到正文下面 */
@media (max-width: 1100px) {
  #layout.has-sidebar { max-width: 1120px; grid-template-columns: minmax(0, 1fr); }
  #sidebar { position: static; margin-top: 0; }
}
footer { text-align: center; color: var(--muted); font-size: 12px; padding: 26px; }

.avatar {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel-2) center/cover no-repeat; padding: 0; cursor: pointer;
  image-rendering: pixelated; box-shadow: var(--shadow);
}
.back {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line); color: var(--fg);
  cursor: pointer; box-shadow: var(--shadow);
}
.back:hover { border-color: var(--accent); }
.avatar.large { width: 92px; height: 92px; border-radius: 18px; }
.profile-head { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }

/* 提示条：固定在视口底部的浮层。以前放在正文最顶上，滚到下面时根本看不见，
   还会用 scrollIntoView 把页面拽回顶部，很打断操作。 */
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
#message {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 80;
  max-width: min(640px, 92vw); padding: 11px 18px; border-radius: 14px; font-size: 14px;
  cursor: pointer;
  box-shadow: 0 16px 40px rgba(6, 10, 20, .45);
  animation: toast-in .24s cubic-bezier(.22, 1, .36, 1);
  word-break: break-word;
}
#message:empty { display: none; }
@media (prefers-reduced-motion: reduce) { #message { animation: none; } }
#message.success { background: color-mix(in srgb, var(--ok) 14%, transparent); border: 1px solid color-mix(in srgb, var(--ok) 45%, transparent); color: var(--ok); }
#message.error { background: color-mix(in srgb, var(--err) 14%, transparent); border: 1px solid color-mix(in srgb, var(--err) 45%, transparent); color: var(--err); }

.welcome { margin-bottom: 26px; }
.welcome h1 { font-size: 28px; margin: 4px 0 8px; }
.welcome p { color: var(--muted); margin: 0; }
.eyebrow { color: var(--accent); font-size: 13px; margin: 0 0 8px; letter-spacing: .06em; }

.card { border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.auth-card { max-width: 520px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
/* 首页「玩家板块」每块磁贴右侧那枚半透明图标：原版物品贴图 16×16，pixelated 放大保住像素边。
   padding-right 是给图标让位，标题和说明不会压到图标上。 */
.tile.has-mark { padding-right: 56px; }
.tile-mark { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; opacity: .30; pointer-events: none; transition: opacity .3s; }
.tile-mark img { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.tile:hover .tile-mark, .tile:focus-visible .tile-mark { opacity: .48; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.facts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.datalist { margin: 0; padding-left: 18px; color: var(--muted); font-size: 14px; }
.datalist li { margin: 3px 0; }

.tile {
  text-align: left; border-radius: var(--radius); padding: 16px; color: var(--fg);
  cursor: pointer;
  /* 悬停像一块玻璃浮起来：抬升 + 同色投影 + 边框高亮 + 顶上一层高光 */
  transition: transform .34s cubic-bezier(.2, .7, .3, 1), border-color .34s, box-shadow .34s;
}
.tile::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background:
    radial-gradient(200px circle at var(--mx, 50%) var(--my, 0%), rgba(255, 255, 255, .18), transparent 62%),
    linear-gradient(145deg, rgba(255, 255, 255, .16), transparent 46%);
  opacity: 0; transition: opacity .34s;
}
/* 扫光：悬停时一道高光从左扫到右（只扫一遍，不循环） */
.tile::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(105deg, transparent 32%, rgba(255, 255, 255, .30) 50%, transparent 68%);
  background-size: 260% 100%; background-position: 170% 0;
  opacity: 0; transition: opacity .34s;
}
.tile:hover, .tile:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  transform: perspective(700px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-4px);
  box-shadow: 0 16px 34px rgba(18, 28, 55, .28),
              0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent),
              0 6px 26px color-mix(in srgb, var(--accent) 26%, transparent);
}
.tile:hover::after, .tile:focus-visible::after { opacity: 1; }
.tile:hover::before, .tile:focus-visible::before {
  opacity: 1;
  background-position: -70% 0;
  transition: opacity .34s, background-position 1.1s ease;
}
.tile:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 2px; }
.tile:active { transform: translateY(-1px); }
@media (prefers-reduced-motion: reduce) {
  .tile { transition: border-color .34s, box-shadow .34s; }
  .tile:hover, .tile:focus-visible, .tile:active { transform: none; }
}
.tile p { color: var(--muted); margin: 0; font-size: 13px; }
.tile.accent { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.tags { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.tag { font-size: 12px; color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 999px; padding: 1px 9px; }

.land { border-radius: 14px; padding: 12px 14px; }
.land h3 { margin: 0; }
.land p { margin: 0; color: var(--muted); font-size: 13px; }

/* 个人主页封面：宽幅背景图 + 头像压在左下角（对齐参考图布局） */
.hero { border-radius: var(--radius); overflow: hidden; margin-bottom: 18px; }
.hero-banner {
  position: relative; width: 100%; aspect-ratio: 3 / 1;
  background-image: linear-gradient(135deg, #3b5bdb 0%, #7048e8 48%, #1098ad 100%);
  background-size: cover; background-position: center; background-repeat: no-repeat;
}
.hero-banner.is-empty::after {
  content: '还没有背景图'; position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center; color: rgba(255, 255, 255, .6); font-size: 13px;
  /* 关键：占位提示铺满封面包围盒，必须放行指针事件，否则会吃掉右上角按钮的点击 */
  pointer-events: none;
}
.hero-actions { position: absolute; top: 12px; right: 12px; display: flex; gap: 8px; z-index: 2; }
.hero-actions button {
  background: rgba(10, 14, 24, .5); border: 1px solid rgba(255, 255, 255, .28); color: #fff;
  box-shadow: none;
}
.hero-body { padding: 0 22px 20px; position: relative; }
.hero-avatar {
  width: 108px; height: 108px; border-radius: 50%; margin-top: -56px;
  border: 4px solid var(--panel-solid); background: var(--panel-2) center/cover no-repeat;
  image-rendering: pixelated; box-shadow: var(--shadow); position: relative;
}
.hero-name { font-size: 26px; font-weight: 800; margin: 12px 0 10px; }
.hero-badges { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.hero-tools { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }

/* 头像可点击更换：悬停时盖一层“更换”遮罩 */
.hero-avatar { cursor: pointer; }
.hero-avatar:hover { border-color: var(--accent); }
.hero-avatar-badge {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: rgba(10, 14, 24, .58); color: #fff; font-size: 13px;
  opacity: 0; transition: opacity .15s; pointer-events: none;
}
.hero-avatar:hover .hero-avatar-badge { opacity: 1; }

/* 浏览器内裁切头像：圆形视口 + 拖拽/缩放 */
/* 裁切弹窗要放下 480px 宽的视口（默认 dialog 内宽只有 416px），窄屏再按 92vw 收缩 */
dialog.cropper { max-width: min(560px, 92vw); }
.cropper { width: auto; max-width: 92vw; }
.crop-stage {
  /* 尺寸由 JS 按目标宽高比内联设置 */
  max-width: 82vw; margin: 0 auto;
  border-radius: 50%; overflow: hidden; position: relative;
  background: var(--panel-2); border: 1px solid var(--line-strong);
  touch-action: none; cursor: grab;
}
.crop-stage.rect { border-radius: 12px; }
.crop-stage:active { cursor: grabbing; }
.crop-stage canvas { width: 100%; height: 100%; display: block; }
.cropper input[type=range] { display: block; width: 320px; max-width: 82vw; margin: 16px auto 0; padding: 0; }
.cropper > form > p { text-align: center; }

@media (max-width: 560px) {
  .hero-avatar { width: 84px; height: 84px; margin-top: -44px; border-width: 3px; }
  .hero-name { font-size: 22px; }
  .hero-body { padding: 0 16px 16px; }
}

.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; padding: 5px 15px; cursor: pointer;
}
.tabs button.selected { color: var(--fg); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }

form label { display: block; margin-bottom: 13px; font-size: 14px; color: var(--muted); }
form label.check { display: flex; align-items: center; gap: 8px; color: var(--fg); }
input, textarea, select {
  width: 100%; margin-top: 6px; padding: 10px 12px; background: var(--panel-2); color: var(--fg);
  border: 1px solid var(--line); border-radius: 12px; font: inherit;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
button {
  padding: 10px 18px; border: none; border-radius: 12px; background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff; font: inherit; cursor: pointer; transition: filter .15s, transform .1s;
}
button:hover { filter: brightness(1.08); }
button:disabled { opacity: .45; cursor: default; filter: none; }   /* 排序到头时的 ↑/↓ */
button:disabled:hover { filter: none; }
button:active { transform: translateY(1px); }
button.secondary {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--fg); box-shadow: none;
}
button.secondary:hover { border-color: var(--accent); }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
button, .button-link { white-space: nowrap; }   /* 中文按钮在窄格子里会竖排，强制不换行 */
/* 但磁贴本身就是 <button>：上面那条会连里面的标题/说明一起继承成不换行，
   手机上文字直接顶出屏幕（表现为"能左右拖一点"）。这里放回正常换行。 */
.tile, .tile * { white-space: normal; }

.table-wrap { overflow-x: auto; max-width: 100%; }
img, video, svg, canvas { max-width: 100%; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 9px 11px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; white-space: nowrap; }
.empty, .muted { color: var(--muted); font-size: 14px; }

.badge { display: inline-block; white-space: nowrap; font-size: 12px; padding: 1px 9px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); }
.badge.positive { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.badge.warn { color: #d69a1f; border-color: color-mix(in srgb, #d69a1f 45%, transparent); background: color-mix(in srgb, #d69a1f 12%, transparent); }

/* 身份药丸：彩色玻璃质感 —— 玩家白 / 管理绿 / 财务蓝 / 服主红。
   和页面其它玻璃面板同一套做法：半透明底色 + 背景模糊 + 内高光 + 同色投影。 */
.identity-badges { display: inline-flex; flex-wrap: wrap; gap: 6px; vertical-align: middle; }
.badge.identity {
  --identity: #ffffff;
  font-weight: 600; padding: 2px 11px;
  color: color-mix(in srgb, var(--identity) 80%, var(--fg));
  background: color-mix(in srgb, var(--identity) 20%, transparent);
  border: 1px solid color-mix(in srgb, var(--identity) 48%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 4px 14px color-mix(in srgb, var(--identity) 25%, transparent);
}
.badge.identity-player { --identity: #ffffff; color: var(--fg); }
.badge.identity-manager { --identity: #2ecc71; }
.badge.identity-finance { --identity: #3b82f6; }
.badge.identity-owner { --identity: #ef4444; }
/* 浅色模式下「白色」药丸得实心 + 描边，否则和浅色面板糊在一起 */
@media (prefers-color-scheme: light) {
  .badge.identity-player {
    background: #ffffff;
    border-color: rgba(20, 30, 55, .22);
    color: #1b2333;
    box-shadow: inset 0 1px 0 #ffffff, 0 4px 14px rgba(30, 42, 70, .12);
  }
}
.button-link { display: inline-block; padding: 10px 18px; border-radius: 12px; background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #fff; }
.button-link:hover { filter: brightness(1.08); }

.module-body > .page-heading { margin-bottom: 8px; }
.module-body form { max-width: 520px; }

/* 换页过渡：旧内容轻轻退一下 → 新页面里**每个板块单独**上滑淡入（顶栏/侧栏/水印不动）。
   板块按顺序错开 45ms，读起来是一层层落下来；.module-body 只是容器不参与，免得和孩子叠加。 */
@keyframes page-out {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translateY(-6px); }
}
@keyframes rise-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
#app.page-leave { animation: page-out .16s ease-in both; }
/* 板块级元素：内容区直接子元素，或透明分组容器（.stagger-group）的子元素。
   延迟由 JS 按插入顺序写进 --rise，这样后加载出来的板块（首页地标广场）也能各自动。 */
#app.stagger > :not(.stagger-group),
#app.stagger .stagger-group > :not(.stagger-group) {
  /* backwards 而不是 both：动画结束后不再保留 opacity/transform，
     否则元素会一直被当成合成层，backdrop-filter 的磨砂会掉（表现就是"一动就变回旧样式"）。 */
  animation: rise-in .72s cubic-bezier(.22, 1, .36, 1) backwards;
  animation-delay: var(--rise, 0ms);
}
@media (prefers-reduced-motion: reduce) {
  #app.page-leave,
  #app.stagger > :not(.stagger-group),
  #app.stagger .stagger-group > :not(.stagger-group) { animation: none; }
}

/* 皮肤库：把 64×64 皮肤按 UV 裁成 6 块，拼成一个正面纸娃娃（整身预览）。
   1 皮肤像素 = 5 CSS 像素 → 320×320 的底图，总尺寸 16×32 皮肤像素 = 80×160。
   每块两层背景：第一层是叠加层（帽子/外套），第二层是本体。 */
.skin-body {
  position: relative; width: 80px; height: 160px; margin: 0 auto 10px;
  flex: none; image-rendering: pixelated;
  filter: drop-shadow(0 10px 16px rgba(20, 30, 55, .35));
}
.skin-body i {
  position: absolute; display: block;
  background-image: var(--skin), var(--skin);
  background-size: 320px 320px, 320px 320px;
  background-repeat: no-repeat, no-repeat;
}
.skin-body .head  { left: 20px; top: 0;     width: 40px; height: 40px; background-position: -200px -40px,  -40px -40px; }
.skin-body .body  { left: 20px; top: 40px;  width: 40px; height: 60px; background-position: -100px -180px, -100px -100px; }
.skin-body .arm-r { left: 0;    top: 40px;  width: 20px; height: 60px; background-position: -220px -180px, -220px -100px; }
.skin-body .arm-l { left: 60px; top: 40px;  width: 20px; height: 60px; background-position: -260px -260px, -180px -260px; }
.skin-body .leg-r { left: 20px; top: 100px; width: 20px; height: 60px; background-position: -20px -180px,  -20px -100px; }
.skin-body .leg-l { left: 40px; top: 100px; width: 20px; height: 60px; background-position: -20px -260px,  -100px -260px; }
.skin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.skin-item { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px; text-align: center; box-shadow: var(--shadow); }
.skin-item .row-actions { justify-content: center; }
.skin-item h3 { word-break: break-all; }

/* 工作台未处理红点 */
.dot-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px; margin-left: 8px;
  border-radius: 999px; background: #e5484d; color: #fff;
  font-size: 12px; font-weight: 700; line-height: 1; vertical-align: middle;
  box-shadow: 0 0 0 2px var(--panel-solid, rgba(0, 0, 0, .35));
}
.tile { position: relative; }
.tile > .dot-badge { position: absolute; top: 10px; right: 10px; margin: 0; }

.replies { border-left: 2px solid var(--line-strong); padding-left: 13px; margin: 10px 0; }

/* 赞助预算：额度 / 已用 / 剩余 */
.budget-figures { display: flex; gap: 26px; flex-wrap: wrap; margin-bottom: 12px; }
.budget-item { display: flex; flex-direction: column; gap: 2px; }
.budget-item strong { font-size: 20px; }
.budget-item.left strong { color: var(--ok); }
.budget-item.over strong { color: var(--err); }
.budget-bar { height: 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; }
.budget-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width .6s cubic-bezier(.22, 1, .36, 1); }
.budget-fill.over { background: var(--err); }
.budget-note { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.budget-note::before { content: '※ '; }
.reply .cost { color: var(--accent); font-size: 13px; }
.reply-input .cost-input { flex: 0 0 150px; }

/* 赞助记录：一条一张卡。金额 / 已支出 / 剩余额度 并排，各自带标签，不用回头看表头。 */
.sp-records { display: grid; gap: 12px; }
.sp-record { margin: 0; padding: 15px 16px; }
.sp-record-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sp-record-head strong { font-size: 15px; }
.sp-record-head time { margin-left: auto; font-size: 12px; color: var(--muted); }
.sp-record .budget-figures { gap: 22px; margin: 10px 0 4px; }
.sp-record .budget-item strong { font-size: 17px; }
.sp-record-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.sp-record-note { margin: 6px 0 0; font-size: 13px; }
.sp-record .replies { margin: 10px 0 4px; }
.sp-record .replies > p:first-child { margin-bottom: 6px; font-size: 12px; }
.sp-record .row-actions { margin-top: 6px; }

/* 赞助 */
.sponsor-donate { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }
.sponsor-donate > div { flex: 1; min-width: 240px; }
.sponsor-donate h3 { margin: 0 0 8px; }
.sponsor-qr {
  width: 260px; max-width: 100%; border-radius: 16px; background: #fff; padding: 10px;
  border: 1px solid var(--line); box-shadow: var(--shadow); display: block;
}
.sponsor-qr.small { width: 180px; margin-bottom: 10px; }

/* 地标 */
.lm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.lm-card, .lm-detail {
  background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.lm-detail { margin-bottom: 18px; }
.lm-cover {
  position: relative; aspect-ratio: 3 / 1; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #3b5bdb, #7048e8 48%, #1098ad);
  background-size: cover; background-position: center; background-repeat: no-repeat;
}
.lm-cover-fallback { color: rgba(255, 255, 255, .88); font-weight: 700; font-size: 18px; letter-spacing: .05em; }
.lm-body { padding: 14px 16px 16px; }
.lm-detail .lm-body { padding: 16px 20px 20px; }
.lm-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lm-title h1 { font-size: 22px; margin: 0; }
.lm-title h3 { margin: 0; }
/* 「这块地已经是地标」的橙色标签：和身份药丸同一套玻璃质感（半透明底 + 模糊 + 内高光 + 同色投影） */
.badge.lm-badge {
  --lm-tag: #f59e0b;
  font-weight: 600;
  color: color-mix(in srgb, var(--lm-tag) 62%, var(--fg));
  background: color-mix(in srgb, var(--lm-tag) 20%, transparent);
  border: 1px solid color-mix(in srgb, var(--lm-tag) 50%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 4px 14px color-mix(in srgb, var(--lm-tag) 25%, transparent);
}
.lm-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 13px; margin: 8px 0; }
.lm-intro {
  color: var(--muted); font-size: 14px; margin: 6px 0 12px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.lm-comment { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.lm-comment p { margin: 0 0 6px; white-space: pre-wrap; word-break: break-word; }
.lm-comment-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stars { color: var(--muted); letter-spacing: 2px; }
.stars .on { color: #f5b301; }.reply { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px; margin-bottom: 8px; }
.reply p { margin: 0 0 4px; }
.reply small { color: var(--muted); }
/* 赞助记录下的回复：跨列子行 */
.reply-row > td { background: color-mix(in srgb, var(--panel-2) 60%, transparent); padding: 4px 11px 12px; }
.reply-row .replies { margin: 6px 0 0; }
.reply-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.reply-input { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.reply-input input { flex: 1; margin: 0; }
.ticket-title { font-weight: 600; margin: 4px 0; }

dl.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 15px; margin: 0; font-size: 14px; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; word-break: break-all; }

dialog {
  border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--fg);
  padding: 22px; max-width: 460px; background: var(--panel-solid);
}
dialog::backdrop { background: rgba(0, 0, 0, .45); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
/* 弹窗内的错误提示：必须出现在用户正看着的地方，不能只丢到页面顶部 */
.dialog-error {
  background: color-mix(in srgb, var(--err) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--err) 45%, transparent);
  color: var(--err); border-radius: 10px; padding: 8px 12px; margin: 0 0 12px; font-size: 14px;
}

/* ===== 玩法文档编辑：整屏稿纸 =====
   正文动辄上千字，原来塞在 460px 的小弹窗里（textarea 只有 7 行），写长文跟手机备忘录一样。
   这里按语雀那套：顶栏放大标题、中间宽稿纸、左边实时大纲（点一条跳到那一段）、底部保存。
   窄屏整页铺满，大纲收起（正文优先）。 */
dialog.doc-editor {
  width: min(1180px, 96vw); max-width: none;
  height: min(88vh, 980px); max-height: none;
  padding: 0; overflow: hidden;
}
dialog.doc-editor[open] { display: flex; }
dialog.doc-editor > .de-box { flex: 1; min-height: 0; display: flex; }
.de-shell { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.de-head {
  flex: none; display: flex; align-items: center; gap: 10px;
  padding: 12px 22px; border-bottom: 1px solid var(--line);
}
.de-title {
  flex: 1; min-width: 0; margin: 0; padding: 6px 2px;
  background: none; border: 0; box-shadow: none;
  font-size: 22px; font-weight: 700; color: var(--fg);
}
.de-title:focus { box-shadow: none; }
.de-tools { flex: none; display: flex; gap: 6px; }
.de-tools button { padding: 4px 10px; border-radius: 8px; font-size: 13px; }
.de-count { flex: none; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.de-main { flex: 1; min-height: 0; display: grid; grid-template-columns: 216px minmax(0, 1fr); }
.doc-nav.de-outline {
  position: static; max-height: none; height: 100%;
  padding: 12px 8px; border: 0; border-right: 1px solid var(--line);
  border-radius: 0; background: none;
}
.doc-nav.de-outline .de-outline-title { flex: none; font-size: 12px; letter-spacing: .12em; color: var(--muted); padding: 0 2px 8px; }
.doc-nav.de-outline .doc-nav-list { flex: 1; }
.de-paper { min-height: 0; display: flex; flex-direction: column; align-items: center; overflow: hidden; }
.de-body {
  flex: 1; min-height: 0; width: 100%; max-width: 780px; margin: 0; padding: 18px 30px 24px;
  background: none; border: 0; border-radius: 0; box-shadow: none; resize: none;
  font-size: 15.5px; line-height: 1.9;
}
.de-body:focus { box-shadow: none; }
/* 配图挂在稿纸下面：不挡正文，缩略图和弹窗里是同一套 */
.de-paper .cn-photos { flex: none; width: 100%; max-width: 780px; padding: 0 30px 12px; }
.de-foot {
  flex: none; display: flex; align-items: center; gap: 10px;
  padding: 10px 22px; border-top: 1px solid var(--line);
}
.de-foot .dialog-error { flex: 1; margin: 0; }
.de-hint { margin-left: auto; color: var(--muted); font-size: 12.5px; }
.de-foot button { flex: none; }

/* 板块内部更新（切标签、刷新、发完邮件）时，新内容一块块上滑淡入。
   由外壳的 MutationObserver 打上 .rise-block，任何板块都自动就有，不用各写一遍。 */
.rise-block {
  /* backwards 而不是 both：动画结束后不再保留 opacity/transform，
     否则元素会一直被当成合成层，backdrop-filter 的磨砂会掉（表现就是"一动就变回旧样式"）。 */
  animation: rise-in .72s cubic-bezier(.22, 1, .36, 1) backwards;
  animation-delay: var(--rise, 0ms);
}
@media (prefers-reduced-motion: reduce) {
  .rise-block { animation: none; }
}

/* 群组：卡片带方图标，群主页顶部是图标 + 资料 + 操作 */
.cg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.cg-card {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .34s cubic-bezier(.2, .7, .3, 1), border-color .34s, box-shadow .34s;
}
.cg-card.clickable { cursor: pointer; }
.cg-card.clickable:hover {
  transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: 0 16px 32px rgba(18, 28, 55, .26), 0 0 22px color-mix(in srgb, var(--accent) 22%, transparent);
}
.cg-card-body { min-width: 0; flex: 1; }
.cg-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cg-title h2, .cg-title h3 { margin: 0; }
.cg-title h3 { font-size: 16px; }
.cg-intro { color: var(--muted); font-size: 13px; margin: 6px 0; word-break: break-word; }
.cg-icon {
  width: 56px; height: 56px; flex: none; border-radius: 14px; overflow: hidden;
  border: 1px solid var(--line); background: var(--panel-2) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18);
}
.cg-icon.big { width: 88px; height: 88px; border-radius: 18px; }
.cg-icon-text { font-size: 22px; font-weight: 700; color: var(--muted); }
.cg-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.cg-head-info { flex: 1; min-width: 220px; }
.cg-head-info .row-actions { margin-top: 10px; }

/* 活动 / 公告：正文保留换行，图片按玻璃卡片排开，点开看大图 */
.cn-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.cn-head h2 { margin: 0 0 6px; }
/* ===== 玩法文档：左侧可折叠目录 =====
   文档是"手册"性质，左边固定一份目录；桌面吸顶，窄屏折到正文上方。
   折叠后只留一条 40px 的竖条（图标 + 竖排「目录」），状态记在 localStorage。 */
.doc-layout { display: grid; grid-template-columns: 224px minmax(0, 1fr); gap: 18px; align-items: start; }
.doc-nav {
  position: sticky; top: 84px; max-height: calc(100vh - 108px);
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--line); border-radius: 14px;
  background-color: var(--panel); padding: 10px 8px;
}
.doc-nav-head { display: flex; align-items: center; gap: 6px; padding: 0 2px 8px; }
.doc-nav-title { flex: 1; font-size: 12px; letter-spacing: .12em; color: var(--muted); }
.doc-nav-toggle {
  flex: none; width: 24px; height: 24px; padding: 0; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; font-size: 14px; color: var(--muted);
  background: var(--panel-2); border: 1px solid var(--line); box-shadow: none;
}
.doc-nav-toggle:hover { color: var(--fg); border-color: var(--accent); }
.doc-nav-list { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; min-height: 0; }
.doc-nav-item {
  /* 目录项是 flex 子项，默认 flex-shrink:1 —— 窗口一矮（或放了 14 篇文档），
     整列会先被压缩到几像素高，文字叠成一团，而不是出现滚动条。锁死不缩，交给 .doc-nav-list 滚。 */
  flex: none;
  text-align: left; padding: 7px 9px; border-radius: 9px; font-size: 13px; line-height: 1.45;
  color: var(--muted); background: none; border: none; box-shadow: none; white-space: normal;
}
.doc-nav-item:hover { color: var(--fg); background: color-mix(in srgb, var(--fg) 6%, transparent); }
.doc-nav-item.is-on { color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, transparent); font-weight: 600; }
.doc-nav.collapsed { width: 44px; padding: 10px 4px; align-items: center; }
.doc-nav.collapsed .doc-nav-title { display: none; }
.doc-nav.collapsed .doc-nav-list { display: none; }
.doc-nav.collapsed .doc-nav-head { padding-bottom: 0; }
.doc-nav.collapsed::after {
  content: '目录'; writing-mode: vertical-rl; letter-spacing: .3em;
  color: var(--muted); font-size: 12px; margin-top: 10px;
}
.doc-article { scroll-margin-top: 90px; }   /* 跳转时别被顶栏挡住 */
/* 文档正文的分级标题（# / ## / ###）：文章标题已是 h2，这里用 h3/h4/h5 */
.doc-body h3, .doc-body h4, .doc-body h5 { scroll-margin-top: 90px; }
.doc-body h3 { font-size: 19px; margin: 24px 0 8px; }
.doc-body h4 { font-size: 16.5px; margin: 20px 0 6px; }
.doc-body h5 { font-size: 14.5px; margin: 16px 0 4px; }
.doc-body h3:first-child, .doc-body h4:first-child, .doc-body h5:first-child { margin-top: 2px; }
.doc-text { white-space: pre-wrap; line-height: 1.75; margin: 0 0 10px; word-break: break-word; }
/* 目录里的小节：按层级缩进，比文档条目轻一点 */
.doc-nav-sub {
  flex: none;
  text-align: left; padding: 5px 9px; border-radius: 8px; font-size: 12.5px; line-height: 1.4;
  color: var(--muted); background: none; border: none; box-shadow: none; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.doc-nav-sub.lv2 { padding-left: 22px; }
.doc-nav-sub.lv3 { padding-left: 34px; }
.doc-nav-sub:hover { color: var(--fg); }
.doc-nav-sub.is-on { color: var(--accent); background: color-mix(in srgb, var(--accent) 11%, transparent); }
/* 文档正文里插入的配图：按原图比例显示，不裁切也不放大；竖图限高，免得一张截图占满整屏 */
.doc-fig { margin: 16px 0; }
.doc-fig img {
  display: block; max-width: 100%; max-height: 72vh; width: auto; height: auto; margin: 0 auto;
  border-radius: 12px; border: 1px solid var(--line); box-shadow: var(--shadow); cursor: zoom-in;
}
.doc-fig figcaption { margin-top: 6px; color: var(--muted); font-size: 13px; text-align: center; }
/* 老文章把图挂在 images 里、正文没引用：仍排在底部，但按原比例整张显示
   （原来塞进固定 16:9 的框里，竖屏截图会被缩成中间一条） */
.doc-article .cn-shot {
  aspect-ratio: auto; background: none;
  width: fit-content; max-width: 100%; justify-self: center;
}
.doc-article .cn-shot img { display: block; max-width: 100%; max-height: 72vh; width: auto; height: auto; }
/* 文档配图一般就一两张，铺满整行才看得清（默认 auto-fill 会缩成 200px 一列） */
.doc-article .cn-gallery { grid-template-columns: minmax(0, 1fr); }
.cn-posts > .card { margin-bottom: 14px; }
@media (max-width: 900px) {
  /* 窄屏：目录折到正文上方，默认收起（点开才展开列表） */
  .doc-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .doc-nav { position: static; max-height: none; }
  .doc-nav.collapsed { width: auto; align-items: stretch; padding: 10px 10px; }
  .doc-nav.collapsed::after { display: none; }
  .doc-nav.collapsed .doc-nav-head { justify-content: space-between; padding-bottom: 0; }
  /* 窄屏收起时仍要看得见「目录」，否则只剩一个孤零零的箭头 */
  .doc-nav.collapsed .doc-nav-title { display: inline; }
}

.cn-body { white-space: pre-wrap; line-height: 1.75; margin: 10px 0 4px; word-break: break-word; }
.cn-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-top: 12px; }
.cn-shot {
  aspect-ratio: 16 / 9; border-radius: 12px; border: 1px solid var(--line); overflow: hidden;
  background: var(--panel-2) center/cover no-repeat; cursor: zoom-in; box-shadow: var(--shadow);
}
.cn-thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.cn-photos-hint { color: var(--muted); font-size: 12.5px; }
.cn-photos.can-insert .cn-thumb-shot { cursor: pointer; }
.cn-photos.can-insert .cn-thumb-shot:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.cn-thumb { position: relative; width: 96px; height: 72px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.cn-thumb-shot { width: 100%; height: 100%; background: var(--panel-2) center/cover no-repeat; }
.cn-thumb-drop {
  position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; padding: 0; line-height: 1;
  border-radius: 50%; background: rgba(10, 16, 30, .72); color: #fff; border: none; box-shadow: none; font-size: 13px;
}
.cn-viewer img { max-width: min(1100px, 88vw); max-height: 78vh; display: block; border-radius: 12px; margin: 0 auto; }
.cn-mail-sum { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 0 0 14px; }
.cn-mail-sum .badge { font-size: 13px; }
.cn-short { color: #ef4444; }
.table-wrap { overflow-x: auto; max-width: 100%; }
img, video, svg, canvas { max-width: 100%; }

/* 图片加载态：液态玻璃 —— 磨砂底 + 两团慢慢漂移的高光/蓝光（液态）+ 一道掠过的光带（加载中）。
   图真的到了就把 .img-loading 摘掉，伪元素一起消失，不会挡住图片。 */
@keyframes glass-drift {
  from { transform: translate3d(-10%, -6%, 0) rotate(-8deg) scale(1); opacity: .7; }
  to { transform: translate3d(10%, 6%, 0) rotate(8deg) scale(1.12); opacity: 1; }
}
@keyframes glass-sweep {
  from { background-position: 170% 0, 0 0; }
  to { background-position: -70% 0, 0 0; }
}
/* 图片真正铺开的那一层：shell.js 的 loadBackground() 会往容器里塞一个 .img-layer，
   图片挂在它身上再淡入。**这层必须有尺寸（inset:0）和 background-size:cover**，
   否则 div 高度为 0，头像/地标封面/领地封面全都"没有图"（2026-10-24 实测就是这个原因）。 */
.img-host { position: relative; overflow: hidden; }
.img-layer {
  position: absolute; inset: 0; pointer-events: none;
  background-position: center; background-size: cover; background-repeat: no-repeat;
  opacity: 0; transition: opacity .34s ease;
}
.img-layer.in { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .img-layer { transition: none; } }
.img-loading { position: relative; overflow: hidden; background-color: var(--panel-2); background-image: none; }
.img-loading::before {
  content: ''; position: absolute; inset: -30%; pointer-events: none;
  background:
    radial-gradient(38% 46% at 32% 38%, rgba(255, 255, 255, .22), transparent 72%),
    radial-gradient(34% 44% at 68% 62%, color-mix(in srgb, var(--accent) 34%, transparent), transparent 74%);
  animation: glass-drift 4.2s ease-in-out infinite alternate;
}
.img-loading::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(110deg, transparent 34%, rgba(255, 255, 255, .18) 50%, transparent 66%) 0 0 / 240% 100% no-repeat;
  animation: glass-sweep 2.6s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .img-loading::before, .img-loading::after { animation: none; }
}

/* ===== 液态玻璃（2026-10-20 四调：透明 + 便宜版边缘透镜）=====
   上一版用 backdrop-filter: url(#svg位移) 做真折射 —— 效果对，但每个面板每帧都要重算
   湍流+位移，页面直接卡。这一版同样"透 + 厚边"，但**只用渐变和内阴影**，零额外滤镜开销：
   · 本体：rgba(255,255,255,.06) + blur(2px)（几乎不糊，背景清楚透出来）
   · 边缘：1px 渐变描边（左上受光、右下暗）+ 内侧上下各一条压缩阴影 = 透镜的厚度感
   · 不做真折射：那是 SVG/WebGL 的活，CSS 里做出来就得吃 GPU。 */
:root {
  --glass-blur: 18px;
  --glass-sat: 128%;
  --edge-light: rgba(255, 255, 255, .85);   /* 边缘受光 */
  --edge-dark: rgba(20, 30, 55, .18);       /* 边缘背光 */
  --rim-glow: rgba(255, 255, 255, .34);     /* 内侧上缘反光 */
  --radius: 18px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --edge-light: rgba(255, 255, 255, .42);
    --edge-dark: rgba(0, 0, 0, .45);
    --rim-glow: rgba(255, 255, 255, .10);
    --glass-sat: 135%;
  }
}

/* 玻璃表面：透明本体 + 透镜厚边（1px 渐变描边由 ::before 画） */
header, .card, dialog, .hero, .cg-card, .lm-card, .skin-item, .land, #sidebar {
  position: relative;
  background-color: var(--panel);
  background-image: none;
  /* 面板这一层重新打开模糊：文字压在页面的泛光/水印上，糊一层背景才读得清。
     只给承载文字的外层面板加，内层磁贴不加（两层叠加既吃 GPU 又会出现双重矩形）。
     之前那次接缝来自"固定定位 + 80px 模糊"的背景层被按视口切块，跟这里的元素级模糊无关。 */
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  border: 1px solid transparent;            /* 描边交给 ::before，才能做渐变 */
  box-shadow:
    inset 0 1px 0 var(--edge-light),        /* 顶边受光亮线 */
    inset 0 -1px 0 var(--edge-dark),        /* 底边折射暗线 */
    inset 0 16px 16px -20px var(--rim-glow),/* 上内侧反光，做玻璃弧度 */
    inset 0 -18px 22px -20px var(--edge-dark),
    0 1px 1px rgba(10, 16, 30, .06),
    0 12px 30px rgba(10, 16, 30, .13),
    0 34px 70px -30px rgba(10, 16, 30, .26);
}
/* 一组里只允许一层玻璃：内层（磁贴 / 地标卡 / 领地卡 / 皮肤卡 / 群卡）一律不铺底色、不投影，
   只留一条淡边线。之前两层半透明叠在同一片区域，边缘会亮两档、看起来就像"断层"。 */
/* 内层（磁贴 / 地标卡 / 领地卡 / 皮肤卡 / 群卡）也要有玻璃感：
   顶面受光的渐变 + 顶边亮线 + 一点点外投影，底边**渐隐到父卡片的底色里**，
   所以既不是纯平面，也不会出现"两块半透明叠出来的硬边矩形"。 */
.tile, .lm-card, .lm-detail, .land, .skin-item, .cg-card {
  background-color: transparent;
  background-image: linear-gradient(178deg, var(--tile-top) 0%, var(--tile-bottom) 52%, transparent 100%);
  border: 1px solid var(--line);
  box-shadow:
    inset 0 1px 0 var(--tile-edge),
    0 10px 24px -16px var(--tile-shadow),
    0 2px 6px -4px var(--tile-shadow);
}
/* 压在玻璃上的说明文字要够沉 */
.tile p, .tile .tile-desc, .land p, .lm-intro, .cg-card p, .skin-item p { color: var(--tile-text); }
.tile h3, .tile h2 { color: var(--fg); letter-spacing: .01em; }
.tile::before, .lm-card::before, .lm-detail::before, .land::before, .skin-item::before, .cg-card::before { display: none; }

/* 透镜边：1px 渐变描边（左上受光 → 右下背光）+ 内侧上下压缩阴影，
   看起来像一块被切出来的厚玻璃。纯渐变和内阴影，**没有滤镜**，开销接近零。 */
header::before, .card::before, dialog::before, .hero::before, .cg-card::before,
.lm-card::before, .skin-item::before, .land::before, #sidebar::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  padding: 1px; pointer-events: none;
  background: linear-gradient(150deg,
    var(--edge-light) 0%, rgba(255, 255, 255, .12) 34%,
    transparent 58%, var(--edge-light) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: exclude;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}


/* 3) 输入控件也做成同一块玻璃 */
input, textarea, select {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .14), transparent 70%);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), inset 0 -10px 18px rgba(10, 16, 30, .05);
}
input:focus, textarea:focus, select:focus {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .26),
              0 0 0 3px color-mix(in srgb, var(--accent) 26%, transparent),
              0 8px 22px color-mix(in srgb, var(--accent) 18%, transparent);
}

/* 4) 顶栏与弹窗：更透，压住内容时不糊字 */
header { background-color: color-mix(in srgb, var(--panel) 78%, transparent); }
dialog::backdrop {
  background: color-mix(in srgb, var(--bg) 62%, transparent);
}

/* 5) 表格行、分割线跟着玻璃走（原来的纯色线在白玻璃上太硬） */
th { color: var(--muted); font-weight: 600; }
tr + tr td { border-top: 1px solid color-mix(in srgb, var(--line) 80%, transparent); }

@media (prefers-reduced-motion: reduce) {
}

/* 工作台里的磁贴别再叠一层玻璃：外框（#sidebar）已经是玻璃了，
   磁贴自己再来一套渐变/噪点/光晕，看起来就像卡片上贴了一堆小牌子，割裂感很强。
   改成「一层均匀的淡色 + 一根细边」，安静地待在里面。 */
#sidebar .tile {
  background-image: none;
  background-color: color-mix(in srgb, var(--fg) 4.5%, transparent);
  border: 1px solid color-mix(in srgb, var(--line) 85%, transparent);
  box-shadow: 0 1px 2px rgba(10, 16, 30, .06);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
@media (prefers-color-scheme: dark) {
  #sidebar .tile { background-color: color-mix(in srgb, var(--fg) 6%, transparent); }
}
#sidebar .tile.accent { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
#sidebar .tile:hover {
  background-color: color-mix(in srgb, var(--fg) 8%, transparent);
  border-color: color-mix(in srgb, var(--accent) 52%, transparent);
  box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 18%, transparent);
}
#sidebar .tile::before, #sidebar .tile::after { opacity: 0 !important; }   /* 扫光/跟随高光在这么小的格子里反而脏 */

/* 「点击块」不要允许选字 / 拖拽：鼠标在磁贴上一抖，浏览器就会弹「拖拽搜索 / 识图」之类的浮层，
   和我们的悬停动效叠在一起很烦。整块禁掉选区与原生拖拽即可，键盘/读屏不受影响。 */
.tile, .land, .cg-card, .cg-icon, .lm-cover, .cn-shot, .cn-thumb, .avatar, .hero-avatar,
.skin-body, .side-rail, .side-toggle, .dot-badge, #sidebar {
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}
/* 正文区域仍然可以正常选中复制 */
.card p, .card h1, .card h2, .card h3, .card li, .card td, .card th, .cn-body { user-select: text; -webkit-user-select: text; }

/* 群组：背景图（卡片横幅 / 详情 hero）+ 玩家名牌预览（对应 vrcnameplate 的卡面） */
.cg-card { position: relative; overflow: hidden; flex-wrap: wrap; }
.cg-banner {
  width: 100%; height: 46px; border-radius: 12px; margin-bottom: 10px;
  background: var(--panel-2) center/cover no-repeat; position: relative;
}
.cg-banner::after, .cg-hero::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(180deg, rgba(8, 12, 24, .10), rgba(8, 12, 24, .42));   /* 遮罩：名字要看得清 */
}
.cg-hero { width: 100%; height: 132px; border-radius: 14px; margin-bottom: 14px; position: relative;
  background: var(--panel-2) center/cover no-repeat; }
.cg-head.cg-style-sunset, .cg-card.cg-style-sunset { border-color: rgba(255, 146, 76, .45); }
.cg-head.cg-style-ocean,  .cg-card.cg-style-ocean  { border-color: rgba(64, 176, 255, .45); }
.cg-head.cg-style-forest, .cg-card.cg-style-forest { border-color: rgba(72, 200, 132, .45); }
.cg-head.cg-style-neon,   .cg-card.cg-style-neon   { border-color: rgba(196, 108, 255, .50); }
.cg-head.cg-style-mono,   .cg-card.cg-style-mono   { border-color: rgba(150, 158, 176, .45); }

/* 六种名片底色的「角标」：详情页标题下那颗小徽章跟着变色 */
.cg-style-badge.glass  { color: var(--fg); }
.cg-style-badge.cg-style-sunset { color: #ff8a3d; border-color: rgba(255, 138, 61, .5); background: rgba(255, 138, 61, .14); }
.cg-style-badge.cg-style-ocean { color: #37a7ff; border-color: rgba(55, 167, 255, .5); background: rgba(55, 167, 255, .14); }
.cg-style-badge.cg-style-forest { color: #3fc47f; border-color: rgba(63, 196, 127, .5); background: rgba(63, 196, 127, .14); }
.cg-style-badge.cg-style-neon { color: #c06cff; border-color: rgba(192, 108, 255, .5); background: rgba(192, 108, 255, .14); }
.cg-style-badge.cg-style-mono { color: #9aa3b5; border-color: rgba(154, 163, 181, .5); background: rgba(154, 163, 181, .14); }

/* 编辑弹窗里的样式选择：一排小色块 */
.cg-styles { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.cg-style-option {
  padding: 7px 14px; border-radius: 999px; font-size: 13px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--panel-2); color: var(--fg); box-shadow: none;
}
.cg-style-option.glass  { background: color-mix(in srgb, #ffffff 22%, transparent); }
.cg-style-option.cg-style-sunset { background: linear-gradient(120deg, #ff9a5a, #ff5d8f); color: #fff; }
.cg-style-option.cg-style-ocean { background: linear-gradient(120deg, #3fa8ff, #4d6bff); color: #fff; }
.cg-style-option.cg-style-forest { background: linear-gradient(120deg, #46d08a, #149e73); color: #fff; }
.cg-style-option.cg-style-neon { background: linear-gradient(120deg, #b46cff, #ff5ec4); color: #fff; }
.cg-style-option.cg-style-mono { background: linear-gradient(120deg, #9aa3b5, #5f6779); color: #fff; }
.cg-style-option.selected { outline: 2px solid var(--accent); outline-offset: 2px; }
.cn-thumb.wide { width: 168px; height: 52px; }

/* 玩家名牌预览：按「玩家名牌-当前样式与适配.md」的现状 —— 头顶只有一行字，
   前缀自带上色 + 名字由 meta.namecolor 上色，没有底板/头像/背景图。
   样式上模仿原版的文字阴影（描边感），让它在浅色/深色背景上都读得清。 */
.np-preview { margin: 8px 0 2px; }
.np-line {
  display: inline-flex; align-items: baseline; gap: 2px;
  padding: 10px 16px; border-radius: 10px;
  /* 只是给这行字垫个深底好看清 —— 虚线边框提醒「这不是游戏里的底板」 */
  background: rgba(18, 24, 38, .42);
  border: 1px dashed rgba(255, 255, 255, .22);
  font: 600 17px/1.35 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: .01em;
}
.np-prefix, .np-name {
  text-shadow:
    1px 1px 0 rgba(0, 0, 0, .85), -1px 1px 0 rgba(0, 0, 0, .85),
    1px -1px 0 rgba(0, 0, 0, .85), -1px -1px 0 rgba(0, 0, 0, .85),
    0 2px 6px rgba(0, 0, 0, .55);
  white-space: pre;
}
.np-name { font-weight: 700; }

/* 工作台里的磁贴别再叠一层玻璃：外框（#sidebar）已经是玻璃了，
   磁贴自己再来一套渐变/噪点/光晕，看起来就像卡片上贴了一堆小牌子，割裂感很强。
   改成「一层均匀的淡色 + 一根细边」，安静地待在里面。 */
#sidebar .tile {
  background-image: none;
  background-color: color-mix(in srgb, var(--fg) 4.5%, transparent);
  border: 1px solid color-mix(in srgb, var(--line) 85%, transparent);
  box-shadow: 0 1px 2px rgba(10, 16, 30, .06);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
@media (prefers-color-scheme: dark) {
  #sidebar .tile { background-color: color-mix(in srgb, var(--fg) 6%, transparent); }
}
#sidebar .tile.accent { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
#sidebar .tile:hover {
  background-color: color-mix(in srgb, var(--fg) 8%, transparent);
  border-color: color-mix(in srgb, var(--accent) 52%, transparent);
  box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 18%, transparent);
}
#sidebar .tile::before, #sidebar .tile::after { opacity: 0 !important; }   /* 扫光/跟随高光在这么小的格子里反而脏 */

/* 「点击块」不要允许选字 / 拖拽：鼠标在磁贴上一抖，浏览器就会弹「拖拽搜索 / 识图」之类的浮层，
   和我们的悬停动效叠在一起很烦。整块禁掉选区与原生拖拽即可，键盘/读屏不受影响。 */
.tile, .land, .cg-card, .cg-icon, .lm-cover, .cn-shot, .cn-thumb, .avatar, .hero-avatar,
.skin-body, .side-rail, .side-toggle, .dot-badge, #sidebar {
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}
/* 正文区域仍然可以正常选中复制 */
.card p, .card h1, .card h2, .card h3, .card li, .card td, .card th, .cn-body { user-select: text; -webkit-user-select: text; }

/* 群组：背景图（卡片横幅 / 详情 hero）+ 玩家名牌预览（对应 vrcnameplate 的卡面） */
.cg-card { position: relative; overflow: hidden; flex-wrap: wrap; }
.cg-banner {
  width: 100%; height: 46px; border-radius: 12px; margin-bottom: 10px;
  background: var(--panel-2) center/cover no-repeat; position: relative;
}
.cg-banner::after, .cg-hero::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(180deg, rgba(8, 12, 24, .10), rgba(8, 12, 24, .42));   /* 遮罩：名字要看得清 */
}
.cg-hero { width: 100%; height: 132px; border-radius: 14px; margin-bottom: 14px; position: relative;
  background: var(--panel-2) center/cover no-repeat; }
.cg-head.cg-style-sunset, .cg-card.cg-style-sunset { border-color: rgba(255, 146, 76, .45); }
.cg-head.cg-style-ocean,  .cg-card.cg-style-ocean  { border-color: rgba(64, 176, 255, .45); }
.cg-head.cg-style-forest, .cg-card.cg-style-forest { border-color: rgba(72, 200, 132, .45); }
.cg-head.cg-style-neon,   .cg-card.cg-style-neon   { border-color: rgba(196, 108, 255, .50); }
.cg-head.cg-style-mono,   .cg-card.cg-style-mono   { border-color: rgba(150, 158, 176, .45); }

/* 六种名片底色的「角标」：详情页标题下那颗小徽章跟着变色 */
.cg-style-badge.glass  { color: var(--fg); }
.cg-style-badge.cg-style-sunset { color: #ff8a3d; border-color: rgba(255, 138, 61, .5); background: rgba(255, 138, 61, .14); }
.cg-style-badge.cg-style-ocean { color: #37a7ff; border-color: rgba(55, 167, 255, .5); background: rgba(55, 167, 255, .14); }
.cg-style-badge.cg-style-forest { color: #3fc47f; border-color: rgba(63, 196, 127, .5); background: rgba(63, 196, 127, .14); }
.cg-style-badge.cg-style-neon { color: #c06cff; border-color: rgba(192, 108, 255, .5); background: rgba(192, 108, 255, .14); }
.cg-style-badge.cg-style-mono { color: #9aa3b5; border-color: rgba(154, 163, 181, .5); background: rgba(154, 163, 181, .14); }

/* 编辑弹窗里的样式选择：一排小色块 */
.cg-styles { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.cg-style-option {
  padding: 7px 14px; border-radius: 999px; font-size: 13px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--panel-2); color: var(--fg); box-shadow: none;
}
.cg-style-option.glass  { background: color-mix(in srgb, #ffffff 22%, transparent); }
.cg-style-option.cg-style-sunset { background: linear-gradient(120deg, #ff9a5a, #ff5d8f); color: #fff; }
.cg-style-option.cg-style-ocean { background: linear-gradient(120deg, #3fa8ff, #4d6bff); color: #fff; }
.cg-style-option.cg-style-forest { background: linear-gradient(120deg, #46d08a, #149e73); color: #fff; }
.cg-style-option.cg-style-neon { background: linear-gradient(120deg, #b46cff, #ff5ec4); color: #fff; }
.cg-style-option.cg-style-mono { background: linear-gradient(120deg, #9aa3b5, #5f6779); color: #fff; }
.cg-style-option.selected { outline: 2px solid var(--accent); outline-offset: 2px; }
.cn-thumb.wide { width: 168px; height: 52px; }

/* 名牌卡面预览（按 vrchat-nameplate/web-handoff 规格）：圆头像 + ID + 前缀徽章，
   底板 = 群组背景图 cover 居中 + 36% 暗色遮罩，圆角 = 高度/2。 */
.np-plate {
  position: relative; display: inline-flex; align-items: center; gap: 9px;
  height: 56px; padding: 0 16px 0 8px; border-radius: 28px; overflow: hidden; max-width: 100%;
  background-color: rgba(14, 18, 28, .92);
  background-size: cover; background-position: center; background-repeat: no-repeat;
  box-shadow: 0 12px 26px rgba(6, 10, 20, .42), inset 0 0 0 1px rgba(255, 255, 255, .08);
}
.np-plate::before { content: ''; position: absolute; inset: 0; background: rgba(8, 10, 16, .36); }
.np-plate > * { position: relative; z-index: 1; }
.np-plate-avatar {
  width: 40px; height: 40px; flex: none; border-radius: 50%;
  background: #1b2233 center/cover no-repeat; box-shadow: 0 0 0 2px rgba(0, 0, 0, .5);
}
.np-plate-name {
  font: 700 21px/1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .01em;
  color: #ffd479; text-shadow: 2px 2px 0 rgba(0, 0, 0, .62); white-space: nowrap;
}
.np-plate-badge {
  font-size: 14px; font-weight: 600; padding: 2px 9px; border-radius: 8px; white-space: nowrap;
  color: #ffc2c2; border: 1px solid rgba(255, 85, 85, .6); background: rgba(255, 85, 85, .15);
  text-shadow: 1px 1px 0 rgba(0, 0, 0, .55);
}
/* 六种名牌样式：只调卡面外圈光晕，底板仍是群背景图 */
.np-plate.cg-style-sunset { box-shadow: 0 12px 26px rgba(255, 120, 60, .32), inset 0 0 0 1px rgba(255, 146, 76, .55); }
.np-plate.cg-style-ocean  { box-shadow: 0 12px 26px rgba(64, 176, 255, .32), inset 0 0 0 1px rgba(64, 176, 255, .55); }
.np-plate.cg-style-forest { box-shadow: 0 12px 26px rgba(72, 200, 132, .30), inset 0 0 0 1px rgba(72, 200, 132, .55); }
.np-plate.cg-style-neon   { box-shadow: 0 12px 30px rgba(196, 108, 255, .42), inset 0 0 0 1px rgba(196, 108, 255, .65); }
.np-plate.cg-style-mono   { box-shadow: 0 12px 26px rgba(10, 14, 22, .45), inset 0 0 0 1px rgba(200, 206, 218, .45); }

/* ===== 首页广告位（2012×604 轮换）=====
   数据来自公开的 /m/banners/feed.json，所以不依赖「广告栏」板块是否对玩家可见；
   管理页（上传/启停/排序）仍然只在工作台、且只有服主/管理能进。 */
.ad-slot { max-width: 1120px; margin: 0 auto 22px; }
.ad-frame {
  position: relative; width: 100%; aspect-ratio: 2012 / 604; overflow: hidden;
  border-radius: var(--radius, 18px); border: 1px solid var(--line);
  box-shadow: 0 18px 44px rgba(10, 16, 30, .28);
  background-color: var(--panel-2, rgba(255,255,255,.03));
}
.ad-slide {
  position: absolute; inset: 0; opacity: 0; transition: opacity .8s ease;
  background-size: cover; background-position: center; background-repeat: no-repeat;
}
.ad-slide.is-on { opacity: 1; }
.ad-dots { position: absolute; left: 0; right: 0; bottom: 12px; display: flex; gap: 8px; justify-content: center; z-index: 2; }
.ad-dot {
  width: 9px; height: 9px; padding: 0; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .75); background: rgba(0, 0, 0, .28);
}
.ad-dot.is-on { background: #fff; }
.ad-frame.ad-empty {
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  border-style: dashed; border-color: var(--line-strong, rgba(255,255,255,.2));
  color: var(--muted); font-size: 14px; letter-spacing: .02em;
}
.ad-frame.ad-empty:hover { border-color: var(--accent, #6d9bff); color: var(--accent, #6d9bff); }
.ad-admin { display: grid; gap: 14px; }
.ad-row {
  display: grid; grid-template-columns: 220px 1fr auto; gap: 14px; align-items: center;
  padding: 10px; border: 1px solid var(--line); border-radius: 14px;
}
.ad-shot { width: 220px; aspect-ratio: 2012 / 604; border-radius: 10px; background: var(--panel-2) center/cover no-repeat; }
.ad-row .ad-ops { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ad-feed { word-break: break-all; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
@media (max-width: 720px) { .ad-row { grid-template-columns: 1fr; } .ad-shot { width: 100%; } }
@media (prefers-reduced-motion: reduce) { .ad-slide { transition: none; } }

/* ===== 手机端（2026-11-06）=====
   窄屏下顶栏原本会被挤成三行（品牌名竖排、退出登录一字一行、头像压成 2px 宽），
   这里把每一块都改成"能缩就缩、该省略就省略"，并放大触摸目标、去掉 iOS 聚焦缩放。 */
@media (max-width: 560px) {
  .page-heading { flex-wrap: wrap; align-items: flex-start; gap: 10px; }
  .tile.has-mark { padding-right: 46px; }
  .tile-mark { top: 12px; right: 12px; width: 30px; height: 30px; opacity: .28; }
  .page-heading > button, .page-heading > .row-actions { margin-left: auto; }
  #topbar {
    gap: 8px; padding: 8px 12px; border-radius: 0 0 14px 14px;
    flex-wrap: nowrap; min-height: 56px;
    overflow: hidden;               /* 头部永不被内容撑出屏幕 */
  }
  #topbar > * { min-width: 0; }
  /* 品牌区不参与压缩（否则「不夜城」会被切一半），让右边的身份块去省略 */
  #topbar .brand { gap: 6px; flex: 0 0 auto; }
  #topbar .brand .sub { display: none; }              /* 窄屏只留「不夜城」 */
  #topbar .brand .mark { white-space: nowrap; font-size: 17px; }
  #topbar .brand-mark { width: 22px; height: 22px; flex: none; }
  #avatar { flex: none; width: 36px; height: 36px; }
  #identity {
    flex: 1 1 auto; min-width: 0; padding: 5px 8px; gap: 4px; font-size: 12px; justify-content: flex-end;
  }
  #identity .identity-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #identity .identity-chevron { display: none; }
  #logout { flex: none; white-space: nowrap; padding: 7px 12px; font-size: 13px; }
  #back { flex: none; width: 34px; height: 34px; }

  #layout { padding: 0 14px; }
  main { padding: 18px 0 56px; }
  .page-heading h1, h1 { font-size: 21px; }
  .welcome h1 { font-size: 22px; }
  .card { padding: 15px 15px; border-radius: 14px; }
  .tile { padding: 14px; }
  .grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }

  /* 广告位在窄屏铺满可用宽度：用 width 计算，不再用负 margin（负 margin 会让文档宽出 28px） */
  .ad-slot { width: calc(100% + 28px); max-width: 100vw; margin-left: -14px; }
  .ad-frame { border-radius: 0; border-left: none; border-right: none; max-width: 100%; }

  /* 表格横向滚动时给点提示空间 */
  .table-wrap { -webkit-overflow-scrolling: touch; }
  table { font-size: 13px; }
  th, td { padding: 8px 10px; }

  /* 弹窗在小屏做成底部抽屉，别把内容压成一条缝 */
  dialog { width: min(94vw, 520px) !important; max-height: 86vh; }
  .dialog-actions { flex-wrap: wrap; gap: 8px; }
  .dialog-actions button { flex: 1 1 auto; }

  /* 提示条别顶到屏幕边缘 */
  #message { bottom: calc(14px + env(safe-area-inset-bottom, 0px)); max-width: 92vw; }

  footer { padding: 20px 14px calc(20px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 359px) {
  #topbar { gap: 6px; padding: 8px 10px; }
  #topbar .brand .mark { font-size: 16px; }
  #logout { padding: 6px 9px; font-size: 12px; }
  #identity { font-size: 11px; padding: 5px 6px; }
}

/* 玩法文档编辑在窄屏整页铺满：上面那句 `dialog { width: min(94vw, 520px) !important }`
   会把编辑页重新压回小弹窗，所以这里必须用 !important 顶回来。大纲让位给正文。 */
@media (max-width: 720px) {
  dialog.doc-editor {
    width: 100vw !important; height: 100dvh !important; max-height: none !important;
    border: 0; border-radius: 0;
  }
  .de-head { padding: 10px 14px; gap: 8px; flex-wrap: wrap; }
  .de-title { font-size: 19px; }
  .de-main { grid-template-columns: minmax(0, 1fr); }
  .de-outline { display: none; }
  .de-body { padding: 12px 16px 18px; font-size: 15px; }
  .de-paper .cn-photos { padding: 0 16px 10px; }
  .de-foot { padding: 8px 14px calc(8px + env(safe-area-inset-bottom, 0px)); }
  .de-hint { display: none; }
  .de-foot button { flex: 1 1 auto; }
}

/* 触摸设备：点击目标至少 44px（Apple HIG / Material 一致），并防止 iOS 聚焦时页面缩放 */
@media (pointer: coarse) {
  /* 触摸屏上手指目标撑到 40~44px；但圆点/小叉这类"图形按钮"必须排除，
     否则 9px 宽 × 40px 高会被拉成椭圆。 */
  button, .button-link, a.button-link { min-height: 40px; }
  #identity, #topbar .brand, #logout, #back { min-height: 40px; }
  .side-toggle { min-width: 40px; min-height: 40px; }
  .tabs button { min-height: 44px; }
  /* 图形按钮：尺寸写死，不吃上面的 min-height */
  .ad-dot, .cn-thumb-drop, .dot-badge { min-height: 0; min-width: 0; }
  .ad-dot { width: 9px; height: 9px; padding: 0; }
  .ad-dots { gap: 10px; }                 /* 圆点保持 9px，靠间距扩大触摸区 */
  body, button, a { -webkit-tap-highlight-color: transparent; }
  input, select, textarea { font-size: 16px; }
  .tile:hover, .tile:active { transform: none; }   /* 手机上 hover 抬升会"粘住"，去掉 */
}
