/* ======================================================================
   方块小岛 · 样式
   自适应：电脑 / 平板 / 手机竖屏 / 手机横屏，刘海屏安全区，触屏与键鼠切换（body.touch）
   ====================================================================== */
:root {
  --st: env(safe-area-inset-top, 0px);
  --sr: env(safe-area-inset-right, 0px);
  --sb: env(safe-area-inset-bottom, 0px);
  --sl: env(safe-area-inset-left, 0px);
  --gap: 12px;
  --btn: 72px;      /* 触屏大按钮 */
  --btn-s: 58px;    /* 触屏小按钮 */
  --joy: 130px;     /* 摇杆 */
  --ink: #1f2933;
  --kb: 0px;        /* 软键盘高度（JS 写入） */
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: #8ec5ff; color: var(--ink);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  overscroll-behavior: none; -webkit-text-size-adjust: 100%;
}
body { position: fixed; inset: 0; }
canvas#game { display: block; touch-action: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
#hud, #touch, #labels, #dg-hud, #hint, #boss-bar { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.hidden { display: none !important; }
.muted { color: #6b7280; font-size: 13px; }
button {
  font: inherit; cursor: pointer; border: 2px solid var(--ink); background: #fff; border-radius: 8px;
  padding: 6px 14px; box-shadow: 0 3px 0 var(--ink); touch-action: manipulation; color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
button.primary { background: #ffd23f; }
button.danger { background: #ffe1e1; }
input, select, textarea { font: inherit; border: 2px solid #c9d1d9; border-radius: 6px; padding: 5px 8px; width: 100%; background: #fff; color: var(--ink); }
input:focus, textarea:focus, select:focus { outline: none; border-color: #3a7bd5; }
label { display: block; font-size: 14px; margin-bottom: 8px; }

/* ---------- 名字和气泡 ---------- */
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }
.label { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; will-change: transform; }
.label .name { background: rgba(31, 41, 51, .72); color: #fff; font-size: 13px; padding: 1px 8px; border-radius: 4px; white-space: nowrap; }
.label.me .name { background: rgba(58, 123, 213, .85); }
.label.sign .name { background: rgba(255, 210, 63, .95); color: var(--ink); font-weight: 700; font-size: 15px; }
.label.portal .name { background: rgba(42, 31, 61, .9); font-weight: 700; font-size: 15px; }
.label.boss .name { background: rgba(200, 20, 60, .9); font-weight: 700; }
.label.remote .name { background: rgba(46, 160, 90, .9); }
.label .sub { font-size: 12px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.8); margin-top: 2px; white-space: nowrap; }
.label .bubble { background: #fff; border: 2px solid var(--ink); border-radius: 10px; padding: 5px 10px; margin-bottom: 6px; font-size: 14px; max-width: 220px; position: relative; line-height: 1.4; }
.label .bubble::after { content: ""; position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); border: 6px solid transparent; border-top-color: var(--ink); }

/* ---------- 顶栏 ---------- */
#hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 3; pointer-events: none;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 8px;
  padding: calc(var(--gap) + var(--st)) calc(var(--gap) + var(--sr)) 0 calc(var(--gap) + var(--sl));
}
.hud-left { min-width: 0; }
.hud-right { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; flex-shrink: 0; }
#hud button { pointer-events: auto; }
#hud-title { font-size: 20px; font-weight: 800; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.35); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#online { font-size: 13px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.6); margin-top: 2px; }
#hud-help { font-size: 13px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.5); margin-top: 2px; max-width: 46vw; }
#btn-settings { padding: 6px 10px; }

#hint {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(28px + var(--sb)); z-index: 3;
  background: rgba(31,41,51,.8); color: #fff; padding: 8px 16px; border-radius: 8px; font-size: 15px;
  max-width: calc(100vw - 32px); text-align: center;
}
#toast {
  position: fixed; top: calc(70px + var(--st)); left: 50%; transform: translateX(-50%); z-index: 20;
  background: var(--ink); color: #fff; padding: 8px 16px; border-radius: 8px; font-size: 14px;
  max-width: calc(100vw - 32px); text-align: center;
}

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center;
  background: rgba(15, 30, 50, .35);
  padding: calc(16px + var(--st)) calc(16px + var(--sr)) calc(16px + var(--sb)) calc(16px + var(--sl));
}
.start-box, .editor-box { background: #fff; border: 3px solid var(--ink); border-radius: 14px; box-shadow: 0 6px 0 var(--ink); }
.start-box { padding: 24px 28px; max-width: 520px; width: 100%; text-align: center; max-height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.start-box h1 { margin: 0 0 8px; font-size: 30px; }
#start-list { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 12px 0 18px; padding: 4px; }
#start-list button { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 76px; }
#start-list canvas { width: 40px; height: 40px; image-rendering: pixelated; border-radius: 4px; }
.start-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
#dgm-body p { margin: 6px 0; line-height: 1.5; }
#dgm-actions { margin-top: 16px; }

/* 设置 */
.settings-box { text-align: left; }
.settings-box h1 { text-align: center; }
.seg { display: flex; gap: 6px; margin: 6px 0 4px; }
.seg button { flex: 1; padding: 6px 4px; }
.seg button.on { background: #ffd23f; }
.set-row { margin: 14px 0; }
.set-row > span { font-weight: 700; font-size: 14px; }
.set-row input[type=range] { padding: 0; border: 0; }
#set-info { margin-top: 4px; }

/* ---------- 对话 ---------- */
#chat {
  position: fixed; z-index: 5; display: flex; flex-direction: column;
  right: calc(16px + var(--sr)); bottom: calc(16px + var(--sb) + var(--kb)); width: 360px; max-height: min(70vh, calc(100dvh - 32px - var(--kb)));
  background: #fff; border: 3px solid var(--ink); border-radius: 14px; box-shadow: 0 6px 0 var(--ink);
}
#chat header { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 2px solid #eef1f4; }
#chat-face { width: 40px; height: 40px; image-rendering: pixelated; border-radius: 4px; }
#chat-name { font-weight: 700; flex: 1; }
#chat-close, #ed-close { padding: 0 10px; font-size: 20px; line-height: 28px; }
#chat-log { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; min-height: 120px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.msg { max-width: 85%; padding: 6px 10px; border-radius: 10px; line-height: 1.45; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.msg.them { background: #f1f4f8; align-self: flex-start; }
.msg.me { background: #ffd23f; align-self: flex-end; }
.msg.sys { align-self: center; color: #6b7280; font-size: 12px; background: none; }
#chat-form { display: flex; gap: 8px; padding: 10px 12px; border-top: 2px solid #eef1f4; }
#chat-form button { white-space: nowrap; }

#say-form { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(70px + var(--sb) + var(--kb)); width: min(420px, 86vw); z-index: 6; }
#say-input { border: 3px solid var(--ink); border-radius: 10px; padding: 8px 12px; box-shadow: 0 4px 0 var(--ink); }

/* ---------- 编辑器 ---------- */
.editor-box { width: 100%; max-width: 820px; max-height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.editor-box header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 2px solid #eef1f4; }
.editor-box h2 { margin: 0; font-size: 20px; }
.ed-top { display: flex; align-items: center; gap: 12px; padding: 10px 16px 0; flex-wrap: wrap; }
.ed-top label { display: flex; align-items: center; gap: 8px; margin: 0; white-space: nowrap; }
.ed-top input { width: 200px; }
.ed-body { display: flex; gap: 16px; padding: 12px 16px; overflow: hidden; flex: 1; min-height: 0; }
.ed-body aside { width: 170px; display: flex; flex-direction: column; gap: 8px; }
#ed-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; border: 2px solid #eef1f4; border-radius: 8px; }
#ed-list li { padding: 7px 10px; cursor: pointer; border-bottom: 1px solid #eef1f4; display: flex; align-items: center; gap: 8px; }
#ed-list li canvas { width: 24px; height: 24px; image-rendering: pixelated; flex-shrink: 0; }
#ed-list li.active { background: #fff6cc; font-weight: 700; }
#ed-form { flex: 1; overflow-y: auto; padding-right: 4px; -webkit-overflow-scrolling: touch; }
.ed-row { display: flex; gap: 16px; }
.ed-preview { background: linear-gradient(#bfe3ff, #e9f6ff); border-radius: 10px; padding: 10px 18px; display: flex; align-items: center; justify-content: center; }
#ed-preview { image-rendering: pixelated; }
.ed-fields { flex: 1; min-width: 0; }
.colors { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.colors input { height: 34px; padding: 2px; }
.photo { margin-bottom: 8px; }
.file-btn { display: inline-block; border: 2px solid var(--ink); border-radius: 8px; padding: 6px 14px; box-shadow: 0 3px 0 var(--ink); cursor: pointer; margin: 0 6px 6px 0; background: #fff; }
#f-crop { margin-top: 8px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.editor-box footer { display: flex; gap: 8px; padding: 12px 16px calc(12px + var(--sb)); border-top: 2px solid #eef1f4; flex-wrap: wrap; }
.grow { flex: 1; }

/* ---------- 副本 ---------- */
#dg-hud {
  position: fixed; top: calc(12px + var(--st)); left: 50%; transform: translateX(-50%); z-index: 3;
  text-align: center; color: #fff; text-shadow: 0 2px 3px rgba(0,0,0,.6); pointer-events: none; max-width: 44vw;
}
#dg-name { font-size: 20px; font-weight: 800; white-space: nowrap; }
#dg-obj { font-size: 15px; margin-top: 2px; white-space: pre-line; }
.dg-row { display: flex; gap: 14px; justify-content: center; margin-top: 4px; font-size: 18px; flex-wrap: wrap; }
#boss-bar { position: fixed; bottom: calc(80px + var(--sb)); left: 50%; transform: translateX(-50%); width: min(480px, 80vw); z-index: 3; text-align: center; pointer-events: none; }
#bb-name { color: #fff; font-weight: 800; text-shadow: 0 2px 3px rgba(0,0,0,.7); margin-bottom: 4px; }
.bb-track { height: 14px; background: rgba(0,0,0,.5); border: 2px solid var(--ink); border-radius: 8px; overflow: hidden; }
#bb-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #ff3d7f, #ff7a1a); transition: width .15s; }
#hurt-flash { position: fixed; inset: 0; pointer-events: none; z-index: 4; opacity: 0; background: radial-gradient(ellipse at center, transparent 45%, rgba(255, 30, 60, .55)); }
#hurt-flash.on { animation: hurt .45s ease-out; }
@keyframes hurt { from { opacity: 1; } to { opacity: 0; } }

/* ---------- 触屏操作（右下角按钮簇 + 左下角摇杆） ---------- */
#touch { position: fixed; inset: 0; pointer-events: none; z-index: 4; display: none; }
body.touch.playing #touch { display: block; } /* 只在游戏里显示，开始界面不显示 */
#joy {
  position: absolute; left: calc(24px + var(--sl)); bottom: calc(24px + var(--sb)); width: var(--joy); height: var(--joy);
  border-radius: 50%; background: rgba(255,255,255,.25); border: 2px solid rgba(255,255,255,.6); pointer-events: auto; touch-action: none;
}
#joy-knob { position: absolute; left: 50%; top: 50%; width: 38%; height: 38%; margin: -19% 0 0 -19%; border-radius: 50%; background: rgba(255,255,255,.85); }
.tbtn { position: absolute; pointer-events: auto; border-radius: 50%; padding: 0; touch-action: none; font-size: 17px; font-weight: 700; }
#t-jump { right: calc(24px + var(--sr)); bottom: calc(24px + var(--sb)); width: var(--btn); height: var(--btn); }
#t-attack { right: calc(36px + var(--btn) + var(--sr)); bottom: calc(20px + var(--sb)); width: var(--btn-s); height: var(--btn-s); background: #ff8a8a; }
#t-talk { right: calc(24px + var(--sr)); bottom: calc(36px + var(--btn) + var(--sb)); width: var(--btn); height: var(--btn); background: #ffd23f; }
#t-say { right: calc(36px + var(--btn) + var(--sr)); bottom: calc(32px + var(--btn-s) + var(--sb)); width: calc(var(--btn-s) - 8px); height: calc(var(--btn-s) - 8px); }

/* 触屏时：提示条和 Boss 血条挪到上面，别压在手指下面 */
body.touch #hud-help { display: none; }
/* 从上往下：副本标题 → Boss 血条 → 提示条 → 弹出提示 */
body.touch #boss-bar { bottom: auto; top: calc(104px + var(--st)); width: min(420px, 70vw); }
body.touch #hint { bottom: auto; top: calc(150px + var(--st)); font-size: 14px; }
body.touch #toast { top: calc(196px + var(--st)); }

/* ---------- 平板 / 小屏电脑 ---------- */
@media (max-width: 900px) {
  #hud-help { display: none; }
}

/* ---------- 手机竖屏 ---------- */
@media (max-width: 600px) {
  :root { --gap: 8px; --btn: 64px; --btn-s: 52px; --joy: 116px; }
  #hud-title { font-size: 16px; }
  #online { font-size: 12px; }
  #hud button { padding: 4px 9px; font-size: 13px; box-shadow: 0 2px 0 var(--ink); }
  .hud-right { max-width: 58vw; }
  #dg-hud { top: calc(64px + var(--st)); max-width: 92vw; }
  #dg-name { font-size: 16px; }
  #dg-obj { font-size: 13px; }
  .dg-row { font-size: 15px; }
  body.touch #boss-bar { top: calc(134px + var(--st)); width: 80vw; }
  body.touch #hint { top: calc(178px + var(--st)); }
  body.touch #toast { top: calc(226px + var(--st)); }
  .label .name { font-size: 12px; }
  .label .bubble { font-size: 13px; max-width: 160px; padding: 4px 8px; }
  .label.portal .name, .label.sign .name { font-size: 13px; }
  .label .sub { font-size: 11px; }

  .start-box { padding: 18px 16px; }
  .start-box h1 { font-size: 24px; }
  #start-list button { min-width: 68px; padding: 6px 8px; }

  #chat { left: calc(8px + var(--sl)); right: calc(8px + var(--sr)); width: auto; bottom: calc(8px + var(--sb) + var(--kb)); max-height: min(55dvh, calc(100dvh - 80px - var(--kb))); }
  #chat-log { min-height: 90px; }

  /* 编辑器全屏 */
  #editor.modal { padding: 0; }
  .editor-box { max-width: none; height: 100%; border-radius: 0; border: 0; box-shadow: none; padding-top: var(--st); }
  .ed-body { flex-direction: column; overflow-y: auto; }
  .ed-body aside { width: auto; }
  #ed-list { max-height: 132px; flex: none; }
  #ed-form { overflow: visible; }
  .ed-row { flex-direction: column; align-items: stretch; }
  .ed-top input { width: auto; flex: 1; }
  .ed-top label { flex: 1; }
  .colors { grid-template-columns: repeat(2, 1fr); }
  #f-crop { grid-template-columns: 1fr; }
}

/* ---------- 手机横屏（矮屏） ---------- */
@media (max-height: 500px) {
  :root { --gap: 8px; --btn: 58px; --btn-s: 48px; --joy: 104px; }
  #hud-title { font-size: 16px; }
  #hud button { padding: 4px 9px; font-size: 13px; box-shadow: 0 2px 0 var(--ink); }
  #dg-name { font-size: 16px; }
  #dg-obj { font-size: 13px; }
  .dg-row { font-size: 15px; }
  body.touch #hint { top: auto; bottom: calc(12px + var(--sb)); font-size: 13px; padding: 6px 12px; max-width: 46vw; }
  body.touch #boss-bar { top: calc(100px + var(--st)); width: min(360px, 44vw); }
  body.touch #toast { top: calc(140px + var(--st)); }
  .set-row { margin: 8px 0; }
  .settings-box h1 { font-size: 20px; margin-bottom: 0; }
  .start-box { padding: 14px 18px; }
  .start-box h1 { font-size: 22px; margin-bottom: 4px; }
  #start-list { margin: 8px 0 12px; }

  /* 对话框靠右，左边留给摇杆和画面 */
  #chat { top: calc(8px + var(--st)); bottom: calc(8px + var(--sb) + var(--kb)); right: calc(8px + var(--sr)); left: auto; width: min(380px, 50vw); max-height: none; }
  #chat-log { min-height: 0; }

  #editor.modal { padding: 0; }
  .editor-box { max-width: none; height: 100%; border-radius: 0; border: 0; box-shadow: none; }
  .ed-body { overflow-y: auto; }
  .ed-body aside { width: 150px; }
  #ed-form { overflow: visible; }
}

/* 横屏又窄的手机：对话框占满宽度会挡住所有东西，保留左侧画面 */
@media (max-height: 500px) and (max-width: 600px) {
  #chat { width: 60vw; }
}

/* 大屏：文字稍大一点 */
@media (min-width: 1600px) {
  .label .name { font-size: 14px; }
  .label .bubble { font-size: 15px; max-width: 260px; }
}

#fps { position: fixed; left: calc(8px + var(--sl)); bottom: calc(8px + var(--sb)); z-index: 30; background: rgba(0,0,0,.55); color: #9dff9d; font: 12px/1.3 ui-monospace, monospace; padding: 3px 6px; border-radius: 4px; pointer-events: none; white-space: pre; }
body.touch #fps { bottom: auto; top: calc(56px + var(--st)); }

/* ---------- 口令 / 找人 / 加入 / 审核 ---------- */
.err { color: #d93636; font-size: 14px; min-height: 1em; margin: 8px 0 0; }
#gate-form input { font-size: 18px; text-align: center; padding: 10px; margin-top: 8px; }
#start-search, #finder-search { margin: 4px 0 8px; }
.start-group { width: 100%; text-align: left; font-weight: 700; font-size: 14px; margin: 8px 0 0; color: #4b5563; }
.finder-box { max-width: 560px; text-align: left; display: flex; flex-direction: column; }
.finder-box h1 { text-align: center; }
#finder-list { overflow-y: auto; flex: 1; min-height: 120px; max-height: 60dvh; -webkit-overflow-scrolling: touch; }
.f-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; margin: 4px 0; box-shadow: 0 2px 0 var(--ink); }
.f-row canvas { width: 32px; height: 32px; image-rendering: pixelated; flex-shrink: 0; }
.f-row .f-name { font-weight: 700; }
.f-row .f-rel { color: #6b7280; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f-row .f-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.f-online { font-size: 12px; color: #16a34a; white-space: nowrap; }
.label.village .name { background: rgba(122, 82, 51, .92); font-weight: 700; font-size: 15px; }
.ed-tabs { display: flex; gap: 6px; padding: 10px 16px 0; }
.ed-tabs button { padding: 5px 12px; box-shadow: 0 2px 0 var(--ink); }
.ed-tabs button.on { background: #ffd23f; }
#ed-pending-n:not(:empty) { background: #ff4d6d; color: #fff; border-radius: 10px; padding: 0 6px; font-size: 12px; }
.ed-tip { margin: 10px 16px 0; padding: 8px 12px; background: #fff6cc; border-radius: 8px; font-size: 14px; }
.ed-pane { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 16px; -webkit-overflow-scrolling: touch; }
#pane-people.ed-pane { padding: 12px 16px; }
#ed-search { margin-bottom: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pend { display: flex; gap: 12px; border: 2px solid #eef1f4; border-radius: 10px; padding: 10px; margin-bottom: 10px; }
.pend canvas { image-rendering: pixelated; flex-shrink: 0; background: linear-gradient(#bfe3ff, #e9f6ff); border-radius: 6px; }
.pend .p-main { flex: 1; min-width: 0; font-size: 14px; line-height: 1.5; }
.pend .p-main b { font-size: 16px; }
.pend .p-acts { display: flex; flex-direction: column; gap: 6px; }
.empty { text-align: center; color: #6b7280; padding: 30px 0; }
@media (max-width: 600px) {
  .two { grid-template-columns: 1fr; }
  .pend { flex-wrap: wrap; }
  .pend .p-acts { flex-direction: row; width: 100%; }
  .pend .p-acts button { flex: 1; }
  .ed-tabs { padding: 8px 12px 0; }
  .ed-pane { padding: 10px 12px; }
  #hud .hud-right #btn-find { order: -1; }
}
/* 人多时名单自己滚动，下面的按钮一直看得见 */
#start .start-box { display: flex; flex-direction: column; overflow: hidden; }
#start-list { overflow-y: auto; min-height: 0; flex: 1 1 auto; max-height: 52dvh; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
@media (max-height: 500px) { #start-list { max-height: 40dvh; } }

/* ---------- 表情 / 拍照 ---------- */
#t-emote { right: calc(36px + var(--btn) + var(--sr)); bottom: calc(44px + var(--btn-s) * 2 + var(--sb)); width: calc(var(--btn-s) - 8px); height: calc(var(--btn-s) - 8px); }
#emote-panel {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + var(--sb)); z-index: 6;
  background: #fff; border: 3px solid var(--ink); border-radius: 14px; box-shadow: 0 5px 0 var(--ink);
  padding: 10px; width: min(560px, calc(100vw - 20px)); display: flex; flex-direction: column; gap: 8px;
}
body.touch #emote-panel { bottom: auto; top: calc(70px + var(--st)); }
.ep-row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.ep-row button { padding: 5px 10px; font-size: 14px; box-shadow: 0 2px 0 var(--ink); }
#ep-emotes button { display: flex; flex-direction: column; align-items: center; min-width: 64px; font-size: 13px; }
#ep-emotes button b { font-size: 24px; line-height: 1.2; }
#ep-emotes kbd { font-size: 10px; color: #6b7280; }
body.touch #ep-emotes kbd { display: none; }
#ep-phrases button { background: #f1f4f8; }

body.photo #hud, body.photo #hint, body.photo #dg-hud, body.photo #boss-bar, body.photo #fps, body.photo #chat { display: none !important; }
body.photo.nonames #labels { display: none; }
#photo-ui { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
#photo-ui .ph-top { position: absolute; top: calc(12px + var(--st)); left: 50%; transform: translateX(-50%); background: rgba(31,41,51,.75); color: #fff; padding: 6px 14px; border-radius: 8px; font-size: 14px; max-width: calc(100vw - 24px); text-align: center; }
#photo-ui .ph-bar { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(18px + var(--sb)); display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; pointer-events: auto; max-width: calc(100vw - 24px); }
body.touch #photo-ui .ph-bar { bottom: auto; top: calc(56px + var(--st)); }
#ph-count { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); font-size: 120px; font-weight: 900; color: #fff; text-shadow: 0 6px 0 var(--ink), 0 0 30px rgba(0,0,0,.3); }
#ph-flash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 40; }
#ph-flash.on { animation: phflash .5s ease-out; }
@keyframes phflash { from { opacity: .9; } to { opacity: 0; } }
.photo-box { max-width: 760px; }
#ph-img { width: 100%; border-radius: 8px; border: 2px solid var(--ink); margin: 6px 0; -webkit-touch-callout: default; user-select: auto; }
.abtn { display: inline-block; text-decoration: none; color: var(--ink); border: 2px solid var(--ink); border-radius: 8px; padding: 6px 14px; box-shadow: 0 3px 0 var(--ink); background: #fff; }
.abtn.primary { background: #ffd23f; }
@media (max-width: 600px) {
  #ep-emotes button { min-width: 0; flex: 1 0 28%; }
  #photo-ui .ph-bar button { padding: 5px 9px; font-size: 13px; }
}

/* ---------- 顶栏菜单（小屏/触屏） ---------- */
#btn-menu { display: none; font-size: 18px; padding: 4px 12px; }
#menu-panel {
  position: fixed; z-index: 8; top: calc(56px + var(--st)); right: calc(var(--gap) + var(--sr));
  display: flex; flex-direction: column; gap: 6px; background: #fff; border: 3px solid var(--ink); border-radius: 12px;
  box-shadow: 0 5px 0 var(--ink); padding: 8px; min-width: 160px;
}
#menu-panel button { text-align: left; box-shadow: 0 2px 0 var(--ink); }
@media (max-width: 760px), (max-height: 500px) {
  #btn-menu { display: inline-block; }
  .hud-right #btn-emote, .hud-right #btn-photo, .hud-right #btn-switch, .hud-right #btn-edit, .hud-right #btn-settings { display: none; }
  .hud-right { flex-wrap: nowrap; max-width: none; }
}
body.touch .hud-right #btn-emote, body.touch .hud-right #btn-photo { display: none; } /* 触屏右下角有 😊，拍照在表情面板里 */
@media (max-height: 500px) { #menu-panel { top: calc(46px + var(--st)); } }

/* ---------- 第二轮自适应修正 ---------- */
/* 拍好的照片：图别撑出屏幕，按钮一直看得见 */
.photo-box { display: flex; flex-direction: column; max-height: 100%; }
#ph-img { max-height: calc(100dvh - 210px); object-fit: contain; min-height: 0; }
/* 小屏/矮屏拍照模式：说明文字收起来，免得和按钮叠 */
@media (max-width: 600px), (max-height: 500px) {
  #photo-ui .ph-top { display: none; }
  .photo-box h1 { font-size: 20px; margin: 0 0 4px; }
  #ph-img { max-height: calc(100dvh - 150px); }
  .photo-box .muted { display: none; }
}
/* 手机横屏：开始界面给名单留足高度 */
@media (max-height: 500px) {
  #start .start-box { padding: 10px 16px; }
  #start .start-box > p:first-of-type { display: none; }
  #start-search { margin: 2px 0 4px; padding: 3px 8px; }
  #start-list { max-height: none; min-height: 110px; margin: 4px 0 8px; }
  #start-list button { min-width: 60px; padding: 4px 6px; font-size: 13px; }
  #start-list canvas { width: 30px; height: 30px; }
  .start-group { margin-top: 2px; }
  #start-note { margin: 4px 0 0; }
  .finder-box { padding: 10px 16px; }
  .finder-box h1 { font-size: 18px; margin: 0; }
  #finder-list { max-height: none; }
}

/* ---------- 首页按钮：主按钮一整行，其余三个等宽 ---------- */
.start-wide { display: block; width: 100%; padding: 10px 14px; font-size: 16px; font-weight: 700; margin: 4px 0 10px; }
.start-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.start-grid button { padding: 8px 4px; white-space: nowrap; font-size: 14px; }
#start-note { margin-top: 12px; }
#start-joined { margin: 0 0 8px; }
@media (max-height: 500px) {
  .start-wide { padding: 6px 12px; font-size: 14px; margin: 2px 0 6px; }
  .start-grid button { padding: 5px 4px; font-size: 13px; }
  #start-note { margin-top: 6px; }
}

/* ---------- 拍照工具栏：中间大快门，两边各两个同样大小的按钮 ---------- */
body.photo #touch { display: none !important; } /* 拍照时把摇杆也收起来 */
#photo-ui .ph-bar, body.touch #photo-ui .ph-bar {
  top: auto; bottom: calc(18px + var(--sb));
  display: grid; grid-template-columns: repeat(2, 64px) 84px repeat(2, 64px); gap: 10px; align-items: center;
  background: rgba(31, 41, 51, .55); border-radius: 20px; padding: 10px 14px; max-width: none;
}
#photo-ui .ph-bar .ph-tool { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 64px; height: 60px; padding: 0; border-radius: 14px; font-size: 12px; }
#photo-ui .ph-bar .ph-tool b { font-size: 22px; line-height: 1; font-weight: 400; }
#photo-ui .ph-bar .ph-tool span { white-space: nowrap; }
#photo-ui .ph-bar .ph-tool.off { opacity: .55; }
#photo-ui .ph-bar .ph-shutter { width: 84px; height: 84px; border-radius: 50%; padding: 0; font-size: 34px; background: #ffd23f; border-width: 3px; box-shadow: 0 4px 0 var(--ink); }
#photo-ui .ph-bar .ph-shutter:active { box-shadow: 0 1px 0 var(--ink); }
@media (max-width: 400px) {
  #photo-ui .ph-bar, body.touch #photo-ui .ph-bar { grid-template-columns: repeat(2, 56px) 72px repeat(2, 56px); gap: 8px; padding: 8px 10px; }
  #photo-ui .ph-bar .ph-tool { width: 56px; height: 54px; font-size: 11px; }
  #photo-ui .ph-bar .ph-tool b { font-size: 20px; }
  #photo-ui .ph-bar .ph-shutter { width: 72px; height: 72px; font-size: 30px; }
}
@media (max-height: 500px) {
  #photo-ui .ph-bar, body.touch #photo-ui .ph-bar { bottom: calc(10px + var(--sb)); padding: 6px 10px; }
  #photo-ui .ph-bar .ph-tool { height: 50px; }
  #photo-ui .ph-bar .ph-shutter { width: 64px; height: 64px; font-size: 28px; }
}

/* ---------- 弹窗底部按钮统一高度和样式 ---------- */
.start-actions > button, .start-actions > .abtn { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 6px 16px; font-size: 15px; line-height: 1.2; }
.photo-box .start-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; }
/* 首页名单用网格，最后一行不满也和上面对齐 */
#start-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; justify-content: stretch; align-content: start; }
#start-list .start-group, #start-list > p { grid-column: 1 / -1; }
#start-list button { min-width: 0; }
@media (max-height: 500px) { #start-list { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 6px; } }

/* 新画风：头像是平滑的矢量画，不再用像素放大 */
#start-list canvas, #ed-list li canvas, #chat-face, #ed-preview, .f-row canvas, .pend canvas { image-rendering: auto; }
.f-row canvas, #start-list canvas, #ed-list li canvas, #chat-face { border-radius: 50%; background: #eef7ff; }

/* ---------- 领地 ---------- */
#coins { font-size: 14px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.6); margin-top: 2px; }
#chat-visit { padding: 3px 9px; font-size: 13px; box-shadow: 0 2px 0 var(--ink); }
.f-wrap { display: flex; gap: 6px; align-items: stretch; }
.f-wrap .f-row { flex: 1; min-width: 0; }
.f-home { flex: 0 0 auto; padding: 0 12px; font-size: 18px; margin: 4px 0; box-shadow: 0 2px 0 var(--ink); }
#home-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + var(--sb)); z-index: 4; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 24px); }
body.touch #home-bar { bottom: auto; top: calc(130px + var(--st)); }
#home-bar button { font-size: 15px; padding: 7px 14px; }
#build-panel {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + var(--sb)); z-index: 6; width: min(640px, calc(100vw - 16px));
  background: #fff; border: 3px solid var(--ink); border-radius: 16px; box-shadow: 0 5px 0 var(--ink); padding: 10px; display: flex; flex-direction: column; gap: 8px;
}
body.touch #build-panel { bottom: auto; top: calc(64px + var(--st)); }
.bp-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
#build-coins { font-weight: 800; }
#build-items { display: grid; grid-auto-flow: column; grid-auto-columns: 74px; gap: 6px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.b-item { display: flex; flex-direction: column; align-items: center; padding: 6px 2px; gap: 1px; box-shadow: 0 2px 0 var(--ink); font-size: 12px; }
.b-item b { font-size: 24px; font-weight: 400; line-height: 1.2; }
.b-item small { color: #6b7280; }
.b-item.on { background: #ffd23f; }
.b-item.poor { opacity: .45; }
.bp-acts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.bp-acts button { padding: 7px 4px; font-size: 14px; }
.bp-acts button:disabled { opacity: .45; }
#build-remove.on { background: #ffe1e1; }
.notes-box { max-width: 520px; text-align: left; display: flex; flex-direction: column; }
.notes-box h1 { text-align: center; font-size: 22px; }
#notes-list { overflow-y: auto; max-height: 50dvh; min-height: 80px; display: flex; flex-direction: column; gap: 8px; margin: 6px 0; }
.note { background: #fff6cc; border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.note small { color: #6b7280; font-size: 11px; }
#notes-form { display: flex; gap: 8px; margin: 6px 0; }
#notes-form button { white-space: nowrap; }
@media (max-width: 600px) {
  #build-items { grid-auto-columns: 64px; }
  .bp-acts button { font-size: 13px; }
  body.touch #home-bar { top: calc(150px + var(--st)); }
}
@media (max-height: 500px) {
  body.touch #build-panel { top: calc(48px + var(--st)); padding: 6px; gap: 4px; }
  #build-items { grid-auto-columns: 60px; }
  .b-item b { font-size: 18px; }
  body.touch #home-bar { top: auto; bottom: calc(12px + var(--sb)); }
}

/* 领地：按钮栏和提示条别叠 */
#home-bar { bottom: calc(72px + var(--sb)); }
body.inhome #hint { bottom: calc(20px + var(--sb)); }
body.touch #home-bar { flex-wrap: nowrap; }
body.touch #home-bar button { font-size: 13px; padding: 6px 10px; white-space: nowrap; }
body.touch.inhome #hint { top: calc(196px + var(--st)); bottom: auto; }
@media (max-width: 600px) { body.touch.inhome #hint { top: calc(200px + var(--st)); } }
@media (max-height: 500px) { body.touch.inhome #hint { top: auto; bottom: calc(60px + var(--sb)); } }

/* ---------- 小镇 / 手机 / 小密码 ---------- */
#t-phone { right: calc(36px + var(--btn) + var(--sr)); bottom: calc(56px + var(--btn-s) * 3 + var(--sb)); width: calc(var(--btn-s) - 8px); height: calc(var(--btn-s) - 8px); }
#t-car { right: calc(24px + var(--sr)); bottom: calc(48px + var(--btn) * 2 + var(--sb)); width: var(--btn); height: var(--btn); background: #7fd6ff; font-size: 15px; }
#phone {
  position: fixed; z-index: 7; right: calc(16px + var(--sr)); bottom: calc(16px + var(--sb)); width: min(340px, calc(100vw - 24px)); max-height: min(78dvh, 620px);
  display: flex; flex-direction: column; gap: 8px; background: #fffdf8; border: 3px solid var(--ink); border-radius: 26px; box-shadow: 0 6px 0 var(--ink); padding: 14px 14px 12px;
}
body.touch #phone { left: 50%; right: auto; transform: translateX(-50%); bottom: auto; top: calc(60px + var(--st)); max-height: calc(100dvh - 90px - var(--st)); }
#phone-body { overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; gap: 8px; }
#phone-body h2 { margin: 2px 0 0; font-size: 18px; text-align: center; }
#phone-body .muted { margin: 0; text-align: center; }
.ph-apps { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 4px; }
.ph-app { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 4px; border-radius: 18px; font-size: 14px; }
.ph-app b { font-size: 32px; font-weight: 400; line-height: 1; }
.ph-back { align-self: flex-start; padding: 3px 10px; font-size: 13px; box-shadow: 0 2px 0 var(--ink); }
.ph-shop { font-weight: 700; font-size: 14px; margin-top: 4px; }
.ph-row { display: flex; flex-wrap: wrap; gap: 6px; }
.ph-row button { padding: 6px 9px; font-size: 13px; box-shadow: 0 2px 0 var(--ink); }
.ph-card { background: #f1f4f8; border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.ph-card p { margin: 0; line-height: 1.5; }
#phone-close { align-self: center; padding: 5px 16px; font-size: 14px; }
#pin-form input { font-size: 22px; text-align: center; letter-spacing: 6px; padding: 8px; margin-top: 6px; }
@media (max-height: 500px) {
  body.touch #phone { top: calc(8px + var(--st)); max-height: calc(100dvh - 16px); width: min(420px, 60vw); left: auto; right: calc(8px + var(--sr)); transform: none; }
}

/* ---------- 📖 人生 ---------- */
body.inevent #touch, body.inevent #hint, body.inevent #dg-hud { display: none !important; }
#ev-title { position: fixed; top: calc(14px + var(--st)); left: 50%; transform: translateX(-50%); z-index: 6; background: rgba(255,255,255,.92); border: 3px solid var(--ink); border-radius: 14px; box-shadow: 0 4px 0 var(--ink); padding: 6px 16px; font-weight: 800; font-size: 17px; white-space: nowrap; max-width: calc(100vw - 150px); overflow: hidden; text-overflow: ellipsis; }
#ev-box {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + var(--sb)); z-index: 7; width: min(720px, calc(100vw - 20px));
  background: #fffdf6; border: 3px solid var(--ink); border-radius: 18px; box-shadow: 0 6px 0 var(--ink); padding: 12px 14px; display: flex; gap: 12px; align-items: flex-start; cursor: pointer;
}
#ev-face canvas { width: 52px; height: 52px; border-radius: 50%; background: #eef7ff; }
.ev-main { flex: 1; min-width: 0; }
#ev-name { font-size: 15px; color: #6b4bbd; }
#ev-text { margin: 4px 0 0; font-size: 17px; line-height: 1.6; min-height: 1.6em; }
#ev-choices { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
#ev-choices button { text-align: left; font-size: 15px; padding: 8px 12px; }
#ev-next { align-self: flex-end; font-size: 18px; padding: 4px 12px; animation: evbob 1s infinite; }
@keyframes evbob { 50% { transform: translateY(-3px); } }
#ev-game {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 8; width: min(460px, calc(100vw - 24px));
  background: #fffdf6; border: 3px solid var(--ink); border-radius: 20px; box-shadow: 0 6px 0 var(--ink); padding: 16px; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center;
}
#ev-game h3 { margin: 0; font-size: 18px; }
.mg-bar { width: 100%; height: 14px; background: #eef1f4; border-radius: 8px; overflow: hidden; border: 2px solid var(--ink); }
.mg-fill { height: 100%; width: 0; background: linear-gradient(90deg, #ffd24d, #ff7b9c); transition: width .08s; }
.mg-tap { width: 120px; height: 120px; border-radius: 50%; font-size: 52px; padding: 0; background: #ffd24d; touch-action: manipulation; }
.mg-tap.pop { animation: pop .15s; }
@keyframes pop { 50% { transform: scale(.9); } }
.mg-info { margin: 0; color: #4b5563; font-weight: 700; }
.mg-q { margin: 0; font-size: 17px; font-weight: 700; }
.mg-opts { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.mg-opts button { font-size: 16px; padding: 9px; }
.mg-opts button.ok, .mg-pick button.ok { background: #bbf7d0; }
.mg-opts button.bad { background: #fecaca; }
.mg-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: 100%; }
.mg-pick button { display: flex; flex-direction: column; align-items: center; padding: 10px 2px; gap: 2px; font-size: 13px; }
.mg-pick button b { font-size: 30px; font-weight: 400; }
.mg-lane { position: relative; width: 100%; height: 34px; background: #eef1f4; border-radius: 17px; border: 2px solid var(--ink); }
.mg-zone { position: absolute; left: 38%; width: 24%; top: 0; bottom: 0; background: rgba(74, 222, 128, .35); border-radius: 12px; }
.mg-zone.hit { animation: hit .3s; } .mg-zone.miss { animation: miss .3s; }
@keyframes hit { 50% { background: rgba(74, 222, 128, .9); } } @keyframes miss { 50% { background: rgba(248, 113, 113, .8); } }
.mg-dot { position: absolute; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #ff7b9c; border: 2px solid var(--ink); }
.life-box { max-width: 760px; display: flex; flex-direction: column; gap: 8px; }
.life-box h1 { font-size: 24px; margin: 0; }
#life-head { margin: 0; }
#life-stages { display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 8px; -webkit-overflow-scrolling: touch; }
.ls { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; padding: 6px 8px; min-width: 64px; font-size: 12px; box-shadow: 0 2px 0 var(--ink); }
.ls b { font-size: 22px; font-weight: 400; }
.ls.on { background: #ffd23f; } .ls.cur { outline: 3px solid #6b4bbd; } .ls.lock { opacity: .55; }
#life-events { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; overflow-y: auto; max-height: 46dvh; padding: 2px; }
.le { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; box-shadow: 0 2px 0 var(--ink); }
.le b { font-size: 28px; font-weight: 400; } .le span { font-weight: 700; font-size: 14px; } .le small { color: #6b7280; font-size: 11px; }
.le.done { background: #ecfdf3; } .le.lock { opacity: .5; }
#life-tags { margin: 0; }
#life-grow { padding: 9px; font-size: 15px; }
#life-grow:disabled { opacity: .55; }
.life-acts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.life-acts button { font-size: 13px; padding: 7px 4px; }
.life-sub { max-width: 620px; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.life-sub h1 { text-align: center; font-size: 22px; margin: 0; }
#life-cast-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; overflow-y: auto; max-height: 55dvh; }
.lc { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; } .lc span { flex: 0 0 64px; font-weight: 700; }
#life-album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; overflow-y: auto; max-height: 62dvh; }
.la { background: #fff8e8; border-radius: 12px; padding: 6px; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.la img { width: 100%; border-radius: 8px; } .la-ph { height: 90px; display: flex; align-items: center; justify-content: center; font-size: 40px; background: #eef7ff; border-radius: 8px; }
.la small, .lm small { color: #6b7280; }
#life-mem-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; max-height: 55dvh; }
.lm { background: #f5f0ff; border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 3px; font-size: 14px; }
@media (max-width: 600px) {
  .life-acts { grid-template-columns: repeat(2, 1fr); }
  #life-cast-list { grid-template-columns: 1fr; }
  #ev-text { font-size: 15px; }
  .mg-pick { grid-template-columns: repeat(3, 1fr); }
  #ev-title { font-size: 14px; max-width: calc(100vw - 120px); }
}
@media (max-height: 500px) {
  #life-events { max-height: 34dvh; }
  #ev-box { padding: 8px 10px; } #ev-text { font-size: 14px; }
  .mg-tap { width: 84px; height: 84px; font-size: 38px; }
}
/* 人生的子窗口（角色、相册、纪念馆）叠在人生面板上面；经历一件事时顶栏只留「结束这段经历」 */
#life-cast, #life-album, #life-mem { z-index: 12; }
body.inevent .hud-right > button:not(#btn-exit) { display: none !important; }

/* ---------- 🧧 节日 ---------- */
#fest-banner { pointer-events: auto; margin-top: 4px; font-size: 12px; padding: 3px 10px; box-shadow: 0 2px 0 var(--ink); background: rgba(255,255,255,.9); max-width: 60vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
#fest-banner.on, #start-fest.on { background: #ffe1e1; border-color: #c81e3a; color: #a3122b; font-weight: 700; animation: festglow 2s infinite; }
@keyframes festglow { 50% { box-shadow: 0 2px 0 var(--ink), 0 0 12px rgba(255, 80, 100, .6); } }
#start-fest { display: block; width: 100%; margin: 4px 0 6px; font-size: 13px; padding: 5px 10px; box-shadow: 0 2px 0 var(--ink); }
.fest-box { max-width: 560px; text-align: left; display: flex; flex-direction: column; gap: 6px; }
#fest-body { overflow-y: auto; max-height: 72dvh; display: flex; flex-direction: column; gap: 6px; }
#fest-body h2 { margin: 4px 0 0; font-size: 20px; } #fest-body h3 { margin: 10px 0 2px; font-size: 15px; }
#fest-body .muted { margin: 0; }
.fest-acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fest-next { display: flex; flex-direction: column; gap: 3px; font-size: 14px; }
.fest-pv { display: flex; flex-wrap: wrap; gap: 6px; }
.fest-pv button { font-size: 12px; padding: 4px 8px; box-shadow: 0 2px 0 var(--ink); }
@media (max-width: 600px) { #fest-banner { max-width: 54vw; } }

/* 游戏内对话框：比所有面板都高一层 */
#ui-dialog { z-index: 40; }
.dialog-box { max-width: 420px; text-align: center; }
.dialog-box h2 { margin: 0 0 8px; font-size: 20px; }
.dialog-box .muted { margin: 0 0 10px; line-height: 1.6; font-size: 14px; }
#uid-input { font-size: 17px; padding: 9px 12px; text-align: center; margin-bottom: 4px; }
.dialog-box .err { margin: 0 0 8px; min-height: 0; }
.dialog-box .err:empty { display: none; }
button.danger-solid { background: #ef4444; color: #fff; }

/* 首页「你是谁」：圈子小块横排、自动换行（覆盖前面的网格写法） */
#start-list { display: flex; flex-wrap: wrap; gap: 12px 16px; justify-content: center; align-content: flex-start; grid-template-columns: none; }
.start-sec { display: flex; flex-direction: column; gap: 4px; max-width: 100%; }
#start-list .start-sec .start-group { grid-column: auto; margin: 0; text-align: left; width: auto; }
.start-sec-people { display: flex; flex-wrap: wrap; gap: 8px; }
.start-sec-people button { width: 72px; min-width: 0; }
@media (max-height: 500px) { .start-sec-people button { width: 60px; } #start-list { gap: 8px 12px; } }

/* ======================================================================
   首页 v2：天空横幅 + logo + 标语
   ====================================================================== */
#start.modal, #gate.modal { background: radial-gradient(ellipse at center, rgba(20, 40, 70, .15), rgba(15, 30, 55, .5)); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.start-v2 { max-width: 580px; padding: 0 0 16px; border-radius: 26px; background: #fffdf6; box-shadow: 0 8px 0 var(--ink), 0 20px 40px rgba(10, 30, 60, .25); overflow: hidden; gap: 0; }
.sv-head {
  position: relative; display: flex; align-items: center; gap: 14px; padding: 18px 22px 16px; text-align: left;
  background:
    radial-gradient(ellipse 60px 20px at 82% 32%, rgba(255,255,255,.9), transparent 70%),
    radial-gradient(ellipse 44px 14px at 70% 70%, rgba(255,255,255,.75), transparent 70%),
    radial-gradient(ellipse 36px 12px at 94% 76%, rgba(255,255,255,.7), transparent 70%),
    linear-gradient(180deg, #7fcbff 0%, #bfe6ff 70%, #dff1ff 100%);
  border-bottom: 3px solid var(--ink);
}
.sv-logo { width: 68px; height: 68px; flex-shrink: 0; filter: drop-shadow(0 4px 0 rgba(31, 41, 51, .35)); animation: svfloat 3.5s ease-in-out infinite; }
@keyframes svfloat { 50% { transform: translateY(-4px) rotate(-2deg); } }
.sv-titles { min-width: 0; }
.start-v2 h1#start-title { margin: 0; font-size: 30px; font-weight: 900; letter-spacing: 2px; color: #fff; text-shadow: 0 3px 0 var(--ink), 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 -2px 0 var(--ink), 2px 2px 0 var(--ink), -2px 2px 0 var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sv-tag { margin: 6px 0 0; font-size: 14px; font-weight: 700; color: #2b4a6b; }
#start .start-v2 { display: flex; flex-direction: column; }
.sv-body { padding: 0 20px; display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; overflow: hidden; }
.sv-body #start-list { flex: 1 1 auto; }
.start-v2 #start-fest { margin-top: 14px; margin-bottom: 0; width: auto; }
.sv-who { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.sv-who h2 { margin: 0; font-size: 18px; white-space: nowrap; }
.sv-who #start-search { margin: 0; flex: 1; min-width: 0; border-radius: 20px; padding: 6px 14px; }
.start-v2 #start-list { margin-top: 10px; margin-bottom: 14px; padding: 12px; background: #f3f8ff; border-radius: 16px; border: 2px dashed #c9dcf0; }
.start-v2 #start-list .start-group { color: #4b6584; }
.start-sec-people button { border-radius: 14px; padding: 7px 4px; background: #fff; transition: transform .12s; }
.start-sec-people button:hover { transform: translateY(-2px); }
.start-sec-people button canvas { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #c9dcf0; }
.start-v2 .start-wide { margin-top: 0; border-radius: 14px; }
.start-v2 .start-grid button { border-radius: 12px; }
.start-v2 #start-note { margin-top: 12px; margin-bottom: 0; text-align: center; }
.start-v2 #start-joined { margin-bottom: 10px; text-align: center; }
.gate-logo { display: block; margin: 0 auto 8px; width: 76px; height: 76px; }
/* 游戏里左上角的岛名带 logo */
.hud-brand { display: flex; align-items: center; gap: 8px; }
.hud-brand img { width: 28px; height: 28px; flex-shrink: 0; filter: drop-shadow(0 2px 0 rgba(0,0,0,.3)); }
@media (max-width: 600px) {
  .sv-head { padding: 14px 16px 12px; gap: 10px; }
  .sv-logo { width: 54px; height: 54px; }
  .start-v2 h1#start-title { font-size: 24px; }
  .sv-tag { font-size: 12px; }
  .sv-body { padding: 0 14px; }
  .start-v2 #start-list { padding: 10px 8px; }
  .hud-brand img { width: 22px; height: 22px; }
}
@media (max-height: 500px) {
  .sv-head { padding: 8px 16px; }
  .sv-logo { width: 40px; height: 40px; }
  .start-v2 h1#start-title { font-size: 20px; }
  .sv-tag { display: none; }
  .sv-who { margin-top: 8px; } .sv-who h2 { font-size: 15px; }
  .start-v2 #start-list { margin: 6px 0 8px; padding: 6px; }
  .sv-body { padding: 0 16px; }
}

/* ---------- 🎨 捏人面板 ---------- */
#pin-modal, #ui-dialog { z-index: 12; }
.ed-preview { flex-direction: column; gap: 8px; align-self: flex-start; position: sticky; top: 0; }
#ed-3d { width: 200px; height: 300px; cursor: grab; touch-action: none; border-radius: 10px; }
#ed-3d:active { cursor: grabbing; }
#mk-random { font-size: 14px; padding: 4px 10px; }
#maker { margin: 6px 0 10px; border: 2px solid #e3e8ee; border-radius: 12px; background: #fbfcfe; }
.mk-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border-bottom: 2px solid #e3e8ee; }
.mk-tabs::-webkit-scrollbar { display: none; }
#maker .chip { flex: none; font-size: 13px; padding: 3px 10px; border-width: 2px; box-shadow: 0 2px 0 var(--ink); border-radius: 999px; background: #fff; }
#maker .chip.on { background: #ffd23f; }
#mk-pane { padding: 8px 10px 10px; }
.mk-row { margin-bottom: 10px; }
.mk-row:last-child { margin-bottom: 0; }
.mk-title { font-size: 13px; color: #5b6673; margin-bottom: 4px; }
.mk-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.mk-swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.mk-sw { width: 30px; height: 30px; padding: 0; border-radius: 50%; border: 2px solid rgba(0,0,0,.18); box-shadow: none; position: relative; font-size: 11px; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; }
.mk-sw.on { outline: 3px solid var(--ink); outline-offset: 2px; }
.mk-sw.auto { width: auto; border-radius: 999px; padding: 0 8px; background: repeating-linear-gradient(45deg, #fff 0 4px, #eef1f5 4px 8px); }
.mk-sw.custom { background: conic-gradient(#e74c3c, #f6c445, #2ecc71, #3a7bd5, #9b59b6, #e74c3c); font-size: 13px; cursor: pointer; }
.mk-sw.custom input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; padding: 0; border: 0; }
@media (max-width: 720px) {
  .ed-preview { position: static; align-self: center; }
  #ed-3d { width: 160px; height: 240px; }
  #mk-pane { max-height: none; }
}

/* ---------- 首页名单：人多的圈子铺满一行；矮屏（手机横屏）整块可滚动 ---------- */
.start-sec.full { width: 100%; }
.start-sec.full .start-sec-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
.start-sec.full .start-sec-people button { width: auto; }
@media (max-width: 600px) { .start-sec.full .start-sec-people { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); } }
@media (max-height: 500px) {
  #start .start-box.start-v2 { padding: 0 0 8px; max-height: calc(100dvh - 16px); }
  .sv-body { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
  .sv-body #start-list { flex: none; max-height: none; min-height: 0; }
  .start-v2 #start-fest { margin-top: 8px; }
  .start-v2 #start-note { margin-top: 6px; }
  .start-sec.full .start-sec-people { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); }
}



#start-pin-tip { margin: 0 0 10px; padding: 7px 12px; font-size: 13px; line-height: 1.5; color: #7a5a00; background: #fff6d6; border: 1.5px solid #f3d27a; border-radius: 12px; text-align: left; }
@media (max-height: 500px) { #start-pin-tip { margin-bottom: 6px; padding: 5px 10px; font-size: 12px; } }

/* ---------- 全站不显示滚动条（内容照样能滑动） ---------- */
* { scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { display: none; width: 0; height: 0; }
/* 捏人面板紧凑一点：标题在左、选项在右，一屏看完不用滚 */
.mk-row { display: grid; grid-template-columns: 64px 1fr; gap: 8px; align-items: start; margin-bottom: 8px; }
.mk-title { margin: 6px 0 0; text-align: right; white-space: nowrap; }
.mk-opts, .mk-swatches { gap: 5px; }
.mk-sw { width: 26px; height: 26px; }
#maker .chip { padding: 2px 9px; }
@media (max-width: 600px) {
  .mk-row { grid-template-columns: 1fr; gap: 3px; }
  .mk-title { text-align: left; margin: 0; }
}
/* 手机：预览缩小钉在顶部，往下翻选项时一直看得到自己的样子；分类排成 3×2 */
@media (max-width: 720px) {
  .ed-preview { position: sticky; top: -12px; z-index: 3; flex-direction: row; align-self: stretch; justify-content: center; gap: 12px; padding: 6px 12px; box-shadow: 0 6px 10px -6px rgba(0,0,0,.25); }
  #ed-3d { width: 110px; height: 165px; }
  #ed-preview { width: 66px; height: 132px; }
  .mk-tabs { display: grid; grid-template-columns: repeat(3, 1fr); }
  #maker .chip { text-align: center; }
  .mk-tabs .chip { padding: 4px 4px; }
}
/* ---------- 🔗 分享 ---------- */
.share-box { max-width: 440px; }
.share-box h1 { font-size: 24px; margin: 0 0 10px; }
#share-img { display: block; width: auto; max-width: 100%; max-height: min(50dvh, 440px); margin: 0 auto; border-radius: 16px; background: linear-gradient(#bfe6ff, #eaf6ff); box-shadow: 0 4px 0 var(--ink); border: 2px solid var(--ink); object-fit: contain; }
#share-tip { margin: 8px 0 6px; }
#share-text { font-size: 13px; line-height: 1.5; text-align: left; background: #f3f8ff; border: 2px dashed #c9dcf0; border-radius: 12px; padding: 8px 10px; margin-bottom: 10px; user-select: text; -webkit-user-select: text; }

/* 顶栏按钮多了：中等宽度把不常用的收进 ☰，手机上只留 找人 / 📱 / 领地 / ☰ */
@media (max-width: 1180px) {
  #btn-menu { display: inline-block; }
  .hud-right #btn-emote, .hud-right #btn-photo, .hud-right #btn-switch, .hud-right #btn-edit, .hud-right #btn-settings { display: none; }
  .hud-right { flex-wrap: nowrap; }
}
@media (max-width: 760px), (max-height: 500px) {
  .hud-right #btn-look, .hud-right #btn-share, .hud-right #btn-life { display: none; }
}

/* 💾 备份 */
#bk-box { margin-top: 14px; border-top: 2px dashed #eef1f4; padding-top: 10px; }
#bk-box h4 { margin: 0 0 4px; font-size: 15px; }
.bk-acts { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
#bk-list { list-style: none; margin: 0; padding: 0; font-size: 13px; }
#bk-list li { display: flex; align-items: center; gap: 6px; padding: 5px 0; border-bottom: 1px solid #f1f3f5; }
#bk-list li span { flex: 1; min-width: 0; }
#bk-list li button { padding: 3px 10px; font-size: 13px; }
@media (max-width: 760px), (max-height: 500px) { .hud-right #btn-cards { display: none; } }

/* 🎴 棋牌室 */
#cards { z-index: 11; padding: calc(10px + var(--st)) calc(10px + var(--sr)) calc(10px + var(--sb)) calc(10px + var(--sl)); }
.cards-box { background: #fff; border: 3px solid var(--ink); border-radius: 16px; box-shadow: 0 6px 0 var(--ink); width: min(980px, 100%); height: min(720px, 100%); display: flex; flex-direction: column; overflow: hidden; }
.cards-box > header { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 2px solid #eef1f4; }
.cards-box > header h2 { margin: 0; font-size: 20px; }
.cards-box .grow { flex: 1; }
#cd-body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
#cards .muted { color: #6b7785; font-size: 13px; }
#cards button.small { padding: 3px 10px; font-size: 13px; }
#cards button.big { font-size: 18px; padding: 10px 18px; }
.cd-face { border-radius: 50%; background: linear-gradient(#bfe3ff, #e9f6ff); flex-shrink: 0; border: 2px solid #fff; box-shadow: 0 0 0 2px #e3e8ee; }
.cd-noface { display: flex; align-items: center; justify-content: center; border-radius: 50%; background: #eef1f4; flex-shrink: 0; font-size: 18px; }
.cd-timer { font-weight: 700; color: #3a7bd5; font-size: 14px; white-space: nowrap; }
.cd-timer.hot { color: #e74c3c; }
/* 大厅 */
.cd-games { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.cd-tile { border: 2px solid var(--ink); border-radius: 14px; padding: 12px; text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center; background: linear-gradient(#fffdf3, #fff); box-shadow: 0 3px 0 var(--ink); }
.cd-emoji { font-size: 40px; line-height: 1; }
.cd-tile b { font-size: 18px; }
.cd-tables h3 { margin: 4px 0 6px; font-size: 16px; }
.cd-trow { display: flex; align-items: center; gap: 10px; border: 2px solid #eef1f4; border-radius: 12px; padding: 8px 10px; margin-bottom: 8px; }
.cd-tinfo { flex: 1; min-width: 0; }
.cd-tseats, .cd-scores { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.cd-chip { display: inline-flex; align-items: center; gap: 4px; background: #f3f8ff; border-radius: 99px; padding: 2px 8px 2px 2px; font-size: 13px; }
.cd-chip.empty { padding: 4px 10px; color: #9aa5b1; background: #f6f7f9; }
.cd-chip.ok { background: #e3f9e9; }
.cd-chip.drawer { background: #fff4cc; }
/* 等人 / 结算 */
.cd-wait { display: flex; flex-direction: column; gap: 10px; flex: 1; min-height: 0; }
.cd-seats { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.cd-seat { width: 120px; border: 2px solid var(--ink); border-radius: 14px; padding: 10px 6px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: 14px; }
.cd-seat.empty { border-style: dashed; border-color: #c9d2dc; }
.cd-seat.me { background: #fff8db; }
.cd-seat .cd-noface { width: 52px; height: 52px; font-size: 22px; color: #9aa5b1; }
.cd-acts { display: flex; gap: 8px; justify-content: center; align-items: center; flex-wrap: wrap; }
.cd-rule { text-align: center; margin: 0; }
.cd-result { text-align: center; border-radius: 14px; padding: 10px; border: 2px solid var(--ink); }
.cd-result b { font-size: 22px; display: block; }
.cd-result.win { background: linear-gradient(#fff3b0, #fffbe6); }
.cd-result.lose { background: #f3f5f8; }
.cd-result .coins { font-weight: 700; color: #b7791f; margin-top: 4px; }
.cd-reveal { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.cd-rv { display: flex; align-items: center; gap: 4px; font-size: 13px; }
/* 聊天 */
.cd-chat { border-top: 2px solid #eef1f4; padding-top: 8px; display: flex; flex-direction: column; gap: 6px; margin-top: auto; }
.cd-log { max-height: 72px; overflow-y: auto; font-size: 13px; line-height: 1.5; }
.cd-chat.big .cd-log { max-height: none; flex: 1; min-height: 60px; }
.cd-log .sys { color: #6b7785; }
.cd-say { display: flex; gap: 6px; }
.cd-say input { flex: 1; min-width: 0; padding: 7px 10px; border: 2px solid #c9d2dc; border-radius: 10px; font-size: 15px; }
/* 扑克 */
.cd-card { width: 46px; height: 66px; border: 2px solid var(--ink); border-radius: 8px; background: #fff; display: flex; flex-direction: column; align-items: flex-start; padding: 2px 4px; line-height: 1; color: #1f2933; flex-shrink: 0; position: relative; box-shadow: 0 2px 0 rgba(31,41,51,.25); user-select: none; -webkit-user-select: none; cursor: pointer; transition: transform .08s; }
.cd-card b { font-size: 18px; }
.cd-card i { font-style: normal; font-size: 16px; }
.cd-card.red { color: #e0322b; }
.cd-card.joker b, .cd-card.joker i { font-size: 15px; font-weight: 800; }
.cd-card.up { transform: translateY(-14px); }
.cd-card.mini { width: 28px; height: 40px; border-width: 1.5px; border-radius: 5px; padding: 1px 2px; cursor: default; box-shadow: none; }
.cd-card.mini b { font-size: 13px; }
.cd-card.mini i { font-size: 11px; }
.cd-card.mini.joker b, .cd-card.mini.joker i { font-size: 10px; }
.cd-card.back { background: repeating-linear-gradient(45deg, #3a7bd5 0 4px, #5b95e6 4px 8px); }
.cd-row { display: flex; gap: 2px; flex-wrap: wrap; justify-content: center; }
.cd-ddz { display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 0; }
.cd-top { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: start; }
.cd-mid { display: flex; flex-direction: column; align-items: center; gap: 4px; padding-top: 4px; }
.cd-bottom { display: flex; gap: 3px; }
.cd-opp { border: 2px solid #eef1f4; border-radius: 12px; padding: 6px 8px; min-height: 110px; display: flex; flex-direction: column; gap: 6px; }
.cd-opp.turn, .cd-mine.turn { border-color: #f6c445; background: #fffbea; }
.cd-opp-top { display: flex; align-items: center; gap: 6px; }
.cd-opp-info { flex: 1; min-width: 0; font-size: 13px; }
.cd-opp-info .n { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cd-count { font-weight: 700; }
.cd-count.warn { color: #e74c3c; }
.cd-role { font-size: 13px; font-weight: 700; }
.cd-act { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 44px; justify-content: center; }
.cd-act.mine { min-height: 48px; }
.cd-say-b { background: #eef1f4; border-radius: 99px; padding: 3px 12px; font-weight: 700; font-size: 14px; }
.cd-type { font-size: 12px; color: #6b7785; }
.cd-mine { border: 2px solid #eef1f4; border-radius: 12px; padding: 6px 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.cd-bar { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; min-height: 40px; }
.cd-bar .cd-role { margin-right: auto; }
.cd-hand { display: flex; justify-content: center; padding-top: 16px; overflow: visible; }
/* 飞行棋 */
.cd-fxq { display: flex; gap: 12px; flex: 1; min-height: 0; }
.cd-board { flex: 1; min-width: 0; min-height: 260px; display: flex; align-items: flex-start; justify-content: center; }
.cd-board canvas { border-radius: 12px; border: 2px solid var(--ink); touch-action: none; }
.cd-fside { width: 260px; display: flex; flex-direction: column; gap: 6px; }
.cd-frow { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 10px; border: 2px solid #eef1f4; font-size: 14px; }
.cd-frow.turn { border-color: #f6c445; background: #fffbea; }
.cd-frow .n { flex: 1; min-width: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cd-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; border: 2px solid #fff; box-shadow: 0 0 0 1px #c9d2dc; }
.cd-fctl { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 0; }
.cd-dice { font-size: 56px; line-height: 1; }
.cd-pick { color: #b7791f; }
.cd-flog { font-size: 13px; color: #4b5563; text-align: center; min-height: 36px; }
/* 你画我猜 */
.cd-hua { display: flex; flex-direction: column; gap: 6px; flex: 1; min-height: 0; }
.cd-hhead { display: flex; align-items: center; gap: 10px; }
.cd-word { flex: 1; text-align: center; font-size: 20px; letter-spacing: 1px; }
.cd-stage { position: relative; flex: 1 1 auto; min-height: 180px; max-height: 52vh; display: flex; justify-content: center; }
.cd-canvas { border: 2px solid var(--ink); border-radius: 12px; background: #fff; touch-action: none; cursor: crosshair; }
.cd-options { position: absolute; inset: 0; display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; background: rgba(255,255,255,.85); border-radius: 12px; }
.cd-tools { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; align-items: center; }
.cd-color { width: 30px; height: 30px; border-radius: 50%; padding: 0; border: 2px solid #c9d2dc; font-size: 14px; }
.cd-color.on, .cd-w.on { outline: 3px solid #f6c445; outline-offset: 1px; }
.cd-w { padding: 4px 10px; }
@media (max-width: 720px) {
  .cards-box { height: 100%; }
  .cd-games { grid-template-columns: 1fr; }
  .cd-tile { flex-direction: row; text-align: left; padding: 8px 10px; }
  .cd-tile .cd-emoji { font-size: 30px; }
  .cd-tile .muted { flex: 1; }
  .cd-top { grid-template-columns: 1fr 1fr; }
  .cd-mid { grid-column: 1 / -1; grid-row: 1; flex-direction: row; justify-content: center; gap: 10px; padding: 0; }
  .cd-opp { min-height: 0; }
  .cd-card { width: 38px; height: 56px; padding: 2px 3px; }
  .cd-card b { font-size: 15px; } .cd-card i { font-size: 13px; }
  .cd-card.mini { width: 22px; height: 32px; } .cd-card.mini b { font-size: 11px; } .cd-card.mini i { font-size: 9px; }
  .cd-fxq { flex-direction: column; }
  .cd-board { min-height: 0; flex: none; }
  .cd-fside { width: auto; }
  .cd-fctl { flex-direction: row; justify-content: center; padding: 2px 0; }
  .cd-dice { font-size: 40px; }
  .cd-seat { width: 96px; }
}
@media (max-height: 500px) {
  #cd-body { padding: 8px 10px; gap: 6px; }
  .cards-box > header { padding: 6px 10px; }
  .cd-opp { min-height: 0; padding: 4px 6px; }
  .cd-card { width: 36px; height: 50px; }
  .cd-hand { padding-top: 12px; }
  .cd-log { max-height: 44px; }
  .cd-stage { max-height: none; }
}
/* 你画我猜：宽屏画布在左、聊天在右 */
.cd-hhead { grid-area: head; } .cd-hua .cd-stage { grid-area: stage; } .cd-tools { grid-area: tools; } .cd-hua .cd-scores { grid-area: scores; } .cd-hua .cd-chat { grid-area: chat; }
@media (min-width: 721px) {
  .cd-hua { display: grid; grid-template-columns: minmax(0, 1fr) 280px; grid-template-rows: auto minmax(0, 1fr) auto auto; grid-template-areas: "head head" "stage chat" "tools chat" "scores chat"; column-gap: 12px; }
  .cd-hua .cd-stage { max-height: none; min-height: 0; align-items: flex-start; }
  .cd-hua .cd-chat { border-top: 0; border-left: 2px solid #eef1f4; padding: 0 0 0 10px; margin: 0; min-height: 0; }
  .cd-hua .cd-chat .cd-log { flex: 1; max-height: none; }
}
@media (max-width: 720px) { .cd-hua .cd-stage { flex: none; min-height: 0; max-height: none; } .cd-word { font-size: 18px; } }

/* ⌨️ 操作说明：小按钮 + 键位卡片（替代原来一大段白字） */
#hud #hud-help { display: inline-flex; align-items: center; margin-top: 6px; padding: 3px 10px; font-size: 13px; max-width: none; color: var(--ink); background: rgba(255,255,255,.85); border: 2px solid var(--ink); border-radius: 99px; box-shadow: 0 2px 0 var(--ink); text-shadow: none; }
#hud #hud-help.on { background: #ffd23f; }
#help-card { pointer-events: auto; margin-top: 8px; background: rgba(255,255,255,.96); border: 2px solid var(--ink); border-radius: 14px; box-shadow: 0 4px 0 var(--ink); padding: 8px 12px; display: grid; grid-template-columns: auto auto; gap: 4px 14px; width: max-content; max-width: 70vw; font-size: 13px; color: var(--ink); cursor: pointer; }
#help-card.hidden { display: none; }
.hk-row { display: contents; }
.hk-keys { display: inline-flex; align-items: center; gap: 3px; justify-self: end; color: #6b7785; }
#help-card kbd { font: 700 12px/1 inherit; font-family: inherit; min-width: 22px; text-align: center; padding: 4px 6px; border: 2px solid var(--ink); border-bottom-width: 3px; border-radius: 6px; background: #fff; color: var(--ink); }
body.touch #hud #hud-help, body.touch #help-card { display: none; }
@media (max-width: 900px) { #hud #hud-help, #help-card { display: none; } }

/* 传送门名牌：一整块卡片，颜色跟传送门一样 */
.label.portal { background: rgba(255,255,255,.95); border: 2px solid var(--ink); border-top: 5px solid var(--pc, #9b59b6); border-radius: 12px; box-shadow: 0 3px 0 var(--ink); padding: 3px 12px 5px; }
.label.portal::after { content: ""; position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%); border: 7px solid transparent; border-top-color: var(--ink); border-bottom: 0; }
.label.portal .name { background: none; color: var(--ink); font-weight: 800; font-size: 15px; padding: 0; }
.label.portal .sub { color: #4b5563; text-shadow: none; font-size: 12px; margin-top: 0; font-weight: 600; }
@media (max-width: 600px) { .label.portal { padding: 2px 8px 3px; border-radius: 10px; } .label.portal .name { font-size: 13px; } .label.portal .sub { font-size: 11px; } }
/* 村子木牌：人数收进牌子里，不再飘一行白字 */
.label.village { background: #fff7e6; border: 2px solid #7a5233; border-top: 5px solid #7a5233; border-radius: 10px; box-shadow: 0 3px 0 #7a5233; padding: 2px 10px 4px; }
.label.village .name { background: none; color: #5a3a22; font-size: 14px; padding: 0; }
.label.village .sub { color: #8b6a4f; text-shadow: none; font-size: 11px; margin-top: 0; font-weight: 600; }
.label.village .sub:empty { display: none; }
@media (max-width: 720px) { .cd-hua .cd-chat.big { flex: 1; min-height: 0; margin-top: 0; } .cd-hua .cd-chat.big .cd-log { flex: 1; min-height: 0; } }

/* 📰 岛报 + 相册 */
#news { z-index: 11; padding: calc(10px + var(--st)) calc(10px + var(--sr)) calc(10px + var(--sb)) calc(10px + var(--sl)); }
.news-box { width: min(760px, 100%); }
.nw-tabs { display: flex; gap: 6px; margin-left: 8px; }
.nw-tabs button { padding: 4px 12px; font-size: 14px; }
.nw-tabs button.on { background: #ffd23f; }
#nw-body { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 14px 14px; }
#btn-news, #btn-menu { position: relative; }
#btn-news.has-new::after, #btn-menu.has-new::after { content: attr(data-n); position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: #e74c3c; color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; border: 2px solid #fff; }
#news .muted { color: #6b7785; font-size: 13px; }
.nw-empty { text-align: center; padding: 30px 10px; }
.nw-day { font-size: 12px; font-weight: 800; color: #9aa5b1; margin: 10px 0 4px; }
.nw-item { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid #f1f3f5; }
.nw-item.new { background: linear-gradient(90deg, #fffbea, transparent); }
.nw-item.bday { background: #ffe9f0; border-radius: 12px; border: 0; margin-bottom: 4px; padding: 8px 10px; font-weight: 700; }
.nw-noface { width: 36px; height: 36px; border-radius: 50%; background: #eef6ff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nw-text { flex: 1; min-width: 0; font-size: 14px; line-height: 1.45; }
.nw-ago { color: #9aa5b1; font-size: 12px; margin-left: 6px; white-space: nowrap; }
.nw-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 2px solid var(--ink); cursor: pointer; flex-shrink: 0; }
.nw-abar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.nw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.nw-cell { position: relative; padding: 0; border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; aspect-ratio: 1; background: #eef1f4; box-shadow: 0 2px 0 var(--ink); }
.nw-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nw-likes { position: absolute; right: 6px; bottom: 6px; background: rgba(255,255,255,.9); border-radius: 99px; padding: 1px 7px; font-size: 12px; font-weight: 700; color: #e0322b; }
.nw-viewer { display: flex; flex-direction: column; gap: 8px; height: 100%; }
.nw-vtop { display: flex; align-items: center; gap: 8px; }
.nw-vtop .grow { flex: 1; }
.nw-vstage { flex: 1; min-height: 200px; display: flex; align-items: center; justify-content: center; background: #f6f7f9; border-radius: 12px; overflow: hidden; }
.nw-vstage img { max-width: 100%; max-height: min(58dvh, 520px); object-fit: contain; display: block; }
.nw-vinfo { display: flex; flex-direction: column; gap: 6px; }
.nw-vwho { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; }
.nw-cap { font-size: 15px; }
.nw-vacts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.nw-vacts button.on { background: #ffe1e8; }
#start-news { display: flex; align-items: center; gap: 6px; width: 100%; margin: 10px 0 0; font-size: 13px; padding: 6px 12px; background: #f3f8ff; border: 2px solid #c9dcf0; border-radius: 99px; box-shadow: none; text-align: left; }
#start-news span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px), (max-height: 500px) { .hud-right #btn-news { display: none; } }
@media (max-width: 720px) { .nw-grid { grid-template-columns: repeat(3, 1fr); gap: 5px; } .nw-tabs button { padding: 4px 8px; } .news-box > header h2 { font-size: 18px; } }
.nw-thumbs { display: flex; gap: 4px; align-items: center; flex-shrink: 0; } @media (max-width: 720px) { .nw-thumb { width: 44px; height: 44px; } }

/* 📦 时光胶囊 */
#btn-phone { position: relative; }
#btn-phone.has-new::after, #t-phone.has-new::after { content: attr(data-n); position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: #e74c3c; color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; border: 2px solid #fff; }
.cap-row { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 8px 10px; font-size: 14px; }
.cap-row b { font-size: 20px; }
.cap-row span { flex: 1; min-width: 0; }
.cap-row.fresh { background: #fff3c4; border-color: #e0a800; font-weight: 700; }
.cap-row:disabled { opacity: .75; cursor: default; }
.cap-lab { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 700; color: #4b5563; margin: 0; }
.cap-ta { font-size: 15px; line-height: 1.5; resize: vertical; }
.ph-row button.on { background: #ffd23f; }
#capsule-letter { z-index: 12; }
.cl-paper { position: relative; width: min(460px, 100%); max-height: 100%; overflow-y: auto; background: repeating-linear-gradient(#fffaf0 0 30px, #f1e6cf 30px 31px); border: 3px solid var(--ink); border-radius: 14px; box-shadow: 0 6px 0 var(--ink); padding: 12px 26px 20px; text-align: center; }
.cl-seal { font-size: 44px; line-height: 1.1; filter: drop-shadow(0 3px 0 rgba(0,0,0,.2)); }
.cl-paper h2 { margin: 0 0 2px; font-size: 20px; }
#cl-text { text-align: left; white-space: pre-wrap; font-size: 16px; line-height: 31px; margin: 14px 0 16px; min-height: 93px; user-select: text; -webkit-user-select: text; }
#capsule-letter.opened .cl-paper { animation: clopen .7s cubic-bezier(.2,1.4,.4,1); }
@keyframes clopen { from { transform: scale(.4) rotate(-6deg); opacity: 0; } to { transform: none; opacity: 1; } }

/* 📋 每日小任务 */
#hud #task-pill { display: inline-flex; align-items: center; margin: 6px 6px 0 0; padding: 3px 10px; font-size: 13px; font-weight: 700; color: var(--ink); background: #fff3c4; border: 2px solid var(--ink); border-radius: 99px; box-shadow: 0 2px 0 var(--ink); }
#hud #task-pill.hidden { display: none; }
#hud #task-pill.done { background: #d9f7e1; }
#hud #task-pill.pop { animation: tkpop .5s; }
@keyframes tkpop { 40% { transform: scale(1.18); } }
#task-card { pointer-events: auto; margin-top: 8px; background: rgba(255,255,255,.97); border: 2px solid var(--ink); border-radius: 14px; box-shadow: 0 4px 0 var(--ink); padding: 8px 12px; width: max-content; max-width: min(320px, 80vw); font-size: 14px; color: var(--ink); cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
#task-card.hidden { display: none; }
.tk-head, .tk-foot { font-size: 12px; color: #6b7785; }
.tk-row { display: flex; align-items: center; gap: 8px; }
.tk-row.done span:last-child { color: #9aa5b1; text-decoration: line-through; }
.tk-check { width: 20px; height: 20px; flex-shrink: 0; border: 2px solid var(--ink); border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 900; color: #fff; background: #fff; }
.tk-row.done .tk-check { background: #2ecc71; }
@media (max-width: 900px) { #hud #hud-help { display: none; } }
@media (max-width: 1180px) { .hud-right #btn-tree { display: none; } }

/* 🌳 关系图 */
#tree { z-index: 11; padding: calc(10px + var(--st)) calc(10px + var(--sr)) calc(10px + var(--sb)) calc(10px + var(--sl)); }
.tree-box { width: min(1100px, 100%); }
#tr-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#tr-edit.on { background: #ffd23f; }
.tr-view { position: relative; flex: 1; min-height: 0; overflow: hidden; background: radial-gradient(circle at 50% 40%, #f3fbff, #e6f2fb); touch-action: none; cursor: grab; }
.tr-stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.tr-svg { position: absolute; left: 0; top: 0; overflow: visible; }
.tr-edge { fill: none; stroke-width: 3; }
.tr-edge.fam { stroke: #e8913a; }
.tr-edge.sib { stroke: #e8913a; stroke-dasharray: 7 6; }
.tr-edge.sp { stroke: #e84393; stroke-width: 4; }
.tr-edge.soc { stroke: #6aa4e8; stroke-width: 2.5; }
.tr-edge.dim, .tr-tag.dim { opacity: .15; }
.tr-tag { position: absolute; transform: translate(-50%, -50%); background: #fff; border: 2px solid #e8913a; color: #9a5310; border-radius: 99px; padding: 0 7px; font-size: 12px; font-weight: 700; white-space: nowrap; pointer-events: auto; }
.tr-tag.soc { border-color: #6aa4e8; color: #2c5d99; }
.tr-tag.sp { border-color: #e84393; color: #b0216b; }
.tr-node { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 6px; border: 0; background: none; box-shadow: none; font-size: 13px; font-weight: 700; color: var(--ink); }
.tr-node span { background: rgba(255,255,255,.95); border: 2px solid var(--ink); border-radius: 8px; padding: 0 6px; white-space: nowrap; }
.tr-node .cd-face { width: 52px; height: 52px; box-shadow: 0 0 0 2px var(--ink); }
.tr-node.me span { background: #3a7bd5; color: #fff; }
.tr-node.focus .cd-face { box-shadow: 0 0 0 4px #ffd23f, 0 0 0 6px var(--ink); }
.tr-node.dim { opacity: .3; }
.tr-cluster { position: absolute; transform: translate(-50%, -50%); background: #ffd23f; border: 2px solid var(--ink); border-radius: 99px; padding: 2px 12px; font-weight: 800; font-size: 14px; white-space: nowrap; box-shadow: 0 2px 0 var(--ink); }
.tr-zoom { position: absolute; right: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 6px; }
.tr-zoom button { width: 40px; height: 40px; padding: 0; font-size: 18px; }
.tr-empty { margin: auto; max-width: 360px; text-align: center; padding: 40px 16px; color: #6b7785; }
.tr-edit { padding: 12px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.tr-edit h3 { margin: 6px 0 0; font-size: 16px; }
.tr-edit .muted { color: #6b7785; font-size: 13px; margin: 0; }
.tr-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tr-form select { width: auto; min-width: 110px; font-size: 15px; }
.tr-list { display: flex; flex-direction: column; gap: 4px; }
.tr-row { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-bottom: 1px solid #f1f3f5; font-size: 14px; }
.tr-row .grow { flex: 1; }
.tr-row .cd-face { width: 32px; height: 32px; }
@media (max-width: 720px) { .tree-box > header h2 { display: none; } #tr-edit { padding: 4px 8px; font-size: 14px; } }

/* 🎣 钓鱼 */
#fish-btn { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + var(--sb)); z-index: 4; font-size: 18px; padding: 10px 22px; background: #5fd0e4; font-weight: 800; }
body.touch #fish-btn { bottom: calc(40px + var(--btn) + var(--sb)); }
#fish-ui { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + var(--sb)); z-index: 5; width: min(420px, calc(100vw - 24px)); background: rgba(255,255,255,.96); border: 3px solid var(--ink); border-radius: 16px; box-shadow: 0 5px 0 var(--ink); padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; text-align: center; }
body.touch #fish-ui { bottom: calc(40px + var(--btn) + var(--sb)); }
#fish-text { font-weight: 800; font-size: 15px; }
#fish-bar { position: relative; height: 30px; border: 2px solid var(--ink); border-radius: 99px; background: #e9eef3; overflow: hidden; cursor: pointer; touch-action: none; }
#fish-zone { position: absolute; top: 0; bottom: 0; background: #57d68d; }
#fish-ptr { position: absolute; top: -2px; bottom: -2px; width: 6px; margin-left: -3px; background: var(--ink); border-radius: 3px; }
.fish-acts { display: flex; gap: 8px; justify-content: center; }
#fish-reel { font-size: 18px; padding: 8px 26px; }
/* 🎒 背包 */
.bag-row { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-bottom: 1px solid #f1f3f5; font-size: 14px; }
.bag-row b { font-size: 22px; }
.bag-row span { flex: 1; }
.dex-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.dex-cell { display: flex; flex-direction: column; align-items: center; padding: 6px 2px; border: 2px solid #eef1f4; border-radius: 10px; font-size: 11px; }
.dex-cell b { font-size: 24px; }
.dex-cell.no { opacity: .45; }
/* 📲 手机 App 和提醒 */
.set-app-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin: 6px 0 4px; }
#set-app-tip { font-size: 12px; line-height: 1.5; }
/* 中等宽度：顶栏只留常用的，其余进 ☰，别把岛名挤没了 */
@media (max-width: 1040px) { .hud-right #btn-look, .hud-right #btn-share, .hud-right #btn-news, .hud-right #btn-cards, .hud-right #btn-arcade, .hud-right #btn-museum { display: none; } }
#hud #task-pill { white-space: nowrap; }
@media (max-width: 1480px) {
  #btn-menu { display: inline-block; }
  .hud-right #btn-emote, .hud-right #btn-photo, .hud-right #btn-switch, .hud-right #btn-edit, .hud-right #btn-settings, .hud-right #btn-tree { display: none; }
}

/* ======================================================================
   👆 触屏布局（重新设计）：右下角一组拇指按钮 —— 跳（最角落）、动作键（左边）、表情 / 喊话（上方弧形）
   ====================================================================== */
body.touch #t-talk, body.touch #t-attack, body.touch #t-car, body.touch #t-phone, body.touch #fish-btn { display: none !important; }
body.touch #t-jump { right: calc(18px + var(--sr)); bottom: calc(18px + var(--sb)); width: var(--btn); height: var(--btn); font-size: 18px; }
#t-act { right: calc(30px + var(--btn) + var(--sr)); bottom: calc(14px + var(--sb)); width: calc(var(--btn) - 2px); height: calc(var(--btn) - 2px); background: #ffd23f; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; line-height: 1.05; font-size: 13px; }
#t-act.hidden { display: none; }
#t-act b { font-size: 22px; line-height: 1; }
#t-act span { white-space: nowrap; }
#t-act.atk { background: #ff8a8a; }
#t-act.car { background: #7fd6ff; }
#t-act.fish { background: #5fd0e4; }
#t-act.farm { background: #9be37f; }
body.touch #t-say { right: calc(18px + (var(--btn) - 46px) / 2 + var(--sr)); bottom: calc(30px + var(--btn) + var(--sb)); width: 46px; height: 46px; font-size: 18px; }
body.touch #t-emote { right: calc(24px + var(--btn) + var(--sr)); bottom: calc(26px + var(--btn) + var(--sb)); width: 46px; height: 46px; font-size: 18px; }
body.touch #joy { left: calc(20px + var(--sl)); bottom: calc(20px + var(--sb)); }
/* 钓鱼面板挪到上面，别压住拇指区 */
body.touch #fish-ui { bottom: auto; top: calc(96px + var(--st)); }
/* 左上角压成两行：岛名 / 积木币 · 今日任务 · 节日 */
body.touch .hud-left { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; max-width: 64vw; }
body.touch .hud-brand { flex-basis: 100%; }
body.touch #online, body.touch #coins { margin: 0; }
body.touch #hud #task-pill { margin: 0; padding: 2px 8px; font-size: 12px; }
body.touch #fest-banner { margin: 0; max-width: 34vw; padding: 2px 8px; font-size: 11px; }
@media (max-width: 600px) {
  body.touch #online { display: none; }
  body.touch .tk-l { display: none; }
  body.touch #fest-banner:not(.on) { display: none; } /* 平时不占地方，节日当天才显示 */
  body.touch #dg-hud { top: calc(62px + var(--st)); }
}
/* 手机横屏：按钮小一点，标题别压住 */
@media (max-height: 500px) {
  body.touch { --btn: 56px; --joy: 104px; }
  body.touch #t-say, body.touch #t-emote { width: 40px; height: 40px; font-size: 16px; }
  body.touch #t-act b { font-size: 19px; }
  body.touch #fish-ui { top: calc(60px + var(--st)); }
  body.touch .tk-l { display: none; }
}

/* ===================== 页面细化：第一批 ===================== */
/* 左上角：岛名、在线、积木币、今日任务、节日、操作说明都做成白底小药丸，横着排，亮天空上也看得清 */
#hud .hud-left { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; max-width: min(440px, 44vw); }
#hud .hud-brand { flex-basis: 100%; display: flex; }
#hud .hud-brand, #hud #online, #hud #coins { background: rgba(255,255,255,.9); border: 2px solid var(--ink); border-radius: 99px; box-shadow: 0 2px 0 var(--ink); margin: 0; }
#hud .hud-brand { width: max-content; flex-basis: auto; padding: 2px 12px 2px 4px; align-items: center; gap: 6px; margin-right: 100%; }
#hud-title { color: var(--ink); text-shadow: none; font-size: 17px; }
#hud #online, #hud #coins { color: var(--ink); text-shadow: none; padding: 1px 9px; font-size: 13px; font-weight: 700; }
#hud #online { color: #3b6e4a; }
#hud #task-pill, #hud #hud-help, #hud #fest-banner { margin: 0; }
#hud #task-card, #hud #help-card { flex-basis: 100%; margin-top: 2px; }
body.touch #hud .hud-left { max-width: 64vw; gap: 4px 5px; }
body.touch #hud .hud-brand { padding: 1px 10px 1px 3px; }
body.touch #hud-title { font-size: 15px; }
body.touch #hud #coins, body.touch #hud #online { padding: 0 8px; font-size: 12px; }
/* 场景标题（领地 / 小镇 / 副本）放到顶栏按钮下面，不和按钮叠 */
#dg-hud { top: calc(64px + var(--st)); background: rgba(31,41,51,.55); border-radius: 14px; padding: 4px 14px 6px; text-shadow: 0 1px 2px rgba(0,0,0,.5); max-width: min(520px, 60vw); }
/* 打开面板时把摇杆和拇指按钮收起来，免得压住面板底部 */
body:has(.modal:not(.hidden):not(#start):not(#gate)) #touch,
body:has(#phone:not(.hidden)) #touch, body:has(#finder:not(.hidden)) #touch, body:has(#menu-panel:not(.hidden)) #touch, body:has(#chat:not(.hidden)) #touch { display: none !important; }
/* 节日面板标题 */
.fest-h { font-size: 22px; margin: 0 0 8px; }
/* 邀请卡生成中 */
#share-modal.drawing #share-img { display: none; }
#share-modal.drawing #share-tip { font-size: 15px; padding: 40px 0; }
/* 空状态：图标 + 一句话 + 按钮 */
.empty-state { margin: auto; max-width: 360px; text-align: center; padding: 36px 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-state .es-icon { font-size: 54px; line-height: 1; filter: drop-shadow(0 3px 0 rgba(31,41,51,.15)); }
.empty-state b { font-size: 17px; }
.empty-state p { margin: 0; line-height: 1.6; }
.empty-state.small { padding: 18px 12px; }
.empty-state.small .es-icon { font-size: 38px; }
@media (max-width: 600px) { #dg-hud { max-width: 66vw; padding: 3px 10px 5px; } #dg-obj { font-size: 12px; } }

/* ☰ 菜单：分组 + 小方块 */
#menu-panel { width: min(300px, calc(100vw - 20px)); gap: 4px; padding: 8px 10px 10px; max-height: calc(100dvh - 70px - var(--st)); overflow-y: auto; }
.mn-h { font-size: 12px; font-weight: 800; color: #6b7785; margin: 4px 2px 0; }
.mn-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
#menu-panel .mn-item { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 6px; text-align: center; border-radius: 12px; font-size: 12px; font-weight: 700; }
.mn-item b { font-size: 22px; line-height: 1; }
@media (max-height: 500px) { #menu-panel { width: min(420px, calc(100vw - 20px)); } .mn-grid { grid-template-columns: repeat(5, 1fr); } #menu-panel .mn-item { padding: 5px 2px 4px; } .mn-item b { font-size: 18px; } }

/* 名字牌统一成圆角小药丸：岛民白底、自己蓝底、在线真人绿底 */
.label .name { background: rgba(255,255,255,.94); color: var(--ink); border: 1.5px solid rgba(31,41,51,.85); border-radius: 99px; padding: 0 9px; font-weight: 700; box-shadow: 0 2px 0 rgba(31,41,51,.35); }
.label.me .name { background: #3a7bd5; color: #fff; border-color: #1f4f96; }
.label.remote .name { background: #2fa866; color: #fff; border-color: #1d6e42; }
.label.remote .name::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #b6ffcf; margin-right: 5px; vertical-align: 2px; }
.label.boss .name { background: #c8143c; color: #fff; border-color: #7a0b24; }
.label.sign .name { border-radius: 8px; }
/* 外卖：菜品卡片 */
.ph-dishes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
#phone .ph-dish { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 2px; border-radius: 12px; font-size: 12px; font-weight: 700; box-shadow: 0 2px 0 var(--ink); }
.ph-dish b { font-size: 24px; line-height: 1.1; }
.ph-dish i { font-style: normal; font-size: 11px; color: #b7791f; }
/* 进岛口令页：和首页同一个头部 */
.gate-v2 { max-width: 420px; }
.gate-v2 .sv-body { display: flex; flex-direction: column; gap: 6px; padding-top: 14px; }
.gate-lock { margin: 0; font-weight: 700; }
.gate-foot { margin: 4px 0 0; font-size: 12px; }
#gate-form.gate-v2 input { margin-top: 4px; }
/* 人生阶段标签：两边渐隐提示还能滑 */
#life-stages.more-r { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
#life-stages.more-l { -webkit-mask-image: linear-gradient(90deg, transparent, #000 15%); mask-image: linear-gradient(90deg, transparent, #000 15%); }
#life-stages.more-l.more-r { -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); }
.label.cartag .name { background: #7fd6ff; color: var(--ink); border: 2px solid var(--ink); font-size: 14px; padding: 2px 12px; box-shadow: 0 3px 0 var(--ink); }

/* 提示条 / 弹出提示：统一成圆角药丸，弹出提示让开场景标题 */
#hint { border-radius: 99px; padding: 7px 18px; background: rgba(31,41,51,.78); font-weight: 600; box-shadow: 0 3px 10px rgba(0,0,0,.12); }
#toast { top: calc(118px + var(--st)); border-radius: 99px; padding: 8px 18px; background: #fff; color: var(--ink); border: 2px solid var(--ink); box-shadow: 0 3px 0 var(--ink); font-weight: 700; }
/* 和岛民聊天：圆头像、带方向的气泡 */
#chat-face { border-radius: 50%; border: 2px solid var(--ink); background: linear-gradient(#bfe3ff, #e9f6ff); image-rendering: auto; }
.msg { border-radius: 16px; padding: 7px 12px; }
.msg.them { border-bottom-left-radius: 4px; border: 1.5px solid #dfe5ec; }
.msg.me { border-bottom-right-radius: 4px; border: 1.5px solid #e0b400; }
#chat-form input { border-radius: 99px; padding: 7px 14px; }
#chat-form button { border-radius: 99px; }
#hud #wx-pill { background: rgba(255,255,255,.9); border: 2px solid var(--ink); border-radius: 99px; box-shadow: 0 2px 0 var(--ink); padding: 1px 9px; font-size: 13px; font-weight: 700; color: var(--ink); }
body.touch #hud #wx-pill { padding: 0 8px; font-size: 12px; }
/* 🐾 宠物名字牌 */
.label.petlabel .name { font-size: 11px; padding: 0 7px; background: #fff7e6; border-color: #b07a52; color: #7a5233; }
.label.petlabel .bubble { font-size: 16px; padding: 2px 6px; margin-bottom: 4px; }
/* 📊 岛主后台 */
#st-body { display: flex; flex-direction: column; gap: 10px; }
.st-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.st-tile { border: 2px solid var(--ink); border-radius: 12px; padding: 8px 10px; display: flex; flex-direction: column; background: #fffdf3; box-shadow: 0 2px 0 var(--ink); }
.st-tile span { font-size: 12px; color: #6b7785; }
.st-tile b { font-size: 24px; }
.st-tile i { font-style: normal; font-size: 11px; color: #9aa5b1; }
.st-card { border: 2px solid #eef1f4; border-radius: 12px; padding: 8px 12px; }
.st-card h4 { margin: 0 0 6px; font-size: 14px; }
.st-list { display: flex; flex-direction: column; gap: 3px; font-size: 13px; max-height: 180px; overflow-y: auto; }
.st-errs div { font-family: ui-monospace, monospace; font-size: 12px; color: #a3122b; word-break: break-all; }
.st-kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 13px; }
.st-kv span { color: #6b7785; }
.st-chart { display: flex; align-items: flex-end; gap: 4px; height: 120px; }
.st-bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; font-size: 10px; color: #6b7785; }
.st-bar i { display: block; width: 70%; min-height: 2px; background: #3a7bd5; border-radius: 4px 4px 0 0; }
.st-bar b { font-size: 11px; color: var(--ink); }
@media (max-width: 720px) { .st-tiles { grid-template-columns: repeat(2, 1fr); } }
.st-bar { max-width: 46px; }

/* ======================================================================
   🪧 地点卡片（传送门 / 村子 / 岛名牌 / 上车）统一成一种：白底圆角卡片 + 顶边色条 + 居中小尖角
   ====================================================================== */
#labels .label.portal, #labels .label.village, #labels .label.sign {
  --pc2: var(--pc, #9b59b6);
  background: #fff; border: 2px solid var(--ink); border-radius: 12px; padding: 5px 14px 6px;
  box-shadow: 0 3px 0 var(--ink), inset 0 4px 0 var(--pc2); text-align: center; gap: 1px;
}
#labels .label.village { --pc2: #b07a52; }
#labels .label.sign { --pc2: #ffd23f; }
#labels .label.portal::after, #labels .label.village::after, #labels .label.sign::after {
  content: ""; position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%);
  border: 7px solid transparent; border-top-color: var(--ink); border-bottom: 0;
}
#labels .label.portal::before, #labels .label.village::before, #labels .label.sign::before {
  content: ""; position: absolute; left: 50%; bottom: -5px; transform: translateX(-50%); z-index: 1;
  border: 5px solid transparent; border-top-color: #fff; border-bottom: 0;
}
#labels .label.portal .name, #labels .label.village .name, #labels .label.sign .name {
  background: none; border: 0; box-shadow: none; padding: 2px 0 0; border-radius: 0;
  color: var(--ink); font-size: 15px; font-weight: 800; letter-spacing: .5px; line-height: 1.3; text-align: center;
}
#labels .label.portal .sub, #labels .label.village .sub, #labels .label.sign .sub {
  color: #6b7785; text-shadow: none; font-size: 11.5px; font-weight: 600; margin: 0; line-height: 1.35; text-align: center;
}
@media (max-width: 600px) {
  #labels .label.portal, #labels .label.village, #labels .label.sign { padding: 4px 10px 5px; border-radius: 10px; }
  #labels .label.portal .name, #labels .label.village .name, #labels .label.sign .name { font-size: 13px; }
  #labels .label.portal .sub, #labels .label.village .sub, #labels .label.sign .sub { font-size: 10.5px; }
}
@media (max-width: 600px) { body.touch .wx-n { display: none; } body.touch #hud .hud-left { max-width: 72vw; } }
/* 演人生经历时：左上角只留岛名，标题别和小药丸叠在一起 */
body.inevent #hud .hud-left > :not(.hud-brand) { display: none !important; }
@media (max-width: 600px) {
  body.inevent #ev-title { top: calc(58px + var(--st)); max-width: calc(100vw - 24px); font-size: 14px; padding: 4px 12px; }
}
@media (max-height: 500px) {
  body.inevent #ev-title { max-width: calc(100vw - 340px); font-size: 14px; padding: 4px 12px; }
}
/* 左上角容器给定宽度，小药丸才排得成一行（不然按岛名宽度缩成一列） */
#hud .hud-left { width: min(440px, 44vw); flex-shrink: 0; }
body.touch #hud .hud-left { width: min(300px, 72vw); }
/* 触屏：左上角浮在左上角，不占顶栏宽度，右边按钮不会被挤出屏幕 */
body.touch #hud .hud-left { position: absolute; left: calc(var(--gap) + var(--sl)); top: calc(var(--gap) + var(--st)); width: min(300px, 72vw); }
body.touch #hud .hud-right { margin-left: auto; }
body.touch #hud .hud-brand { max-width: calc(100vw - 250px); }
body.touch #hud-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ===================== 打磨：手机竖屏逐页检查后的修正 ===================== */
/* 多行说明文字平衡每行长度，别让最后一个字单独落一行 */
.start-box p, #cards .muted, #news .muted, #tree .muted, .empty-state p, .empty-state b, #life-head, #fest-body p, #set-info, #set-app-tip, .cd-tile .muted, #phone .muted { text-wrap: pretty; } /* pretty：只防最后一个字落单，不硬拉平（balance 会把「手机」这种词拆开） */
.empty-state b, #life-head { text-wrap: balance; }
/* 空页面：内容放在空白区域中间，不要挤在顶上 */
#nw-body, #tr-body { display: flex; flex-direction: column; }
.nw-feed, .nw-album { flex: 1; display: flex; flex-direction: column; }
.empty-state { margin: auto; justify-content: center; }
.empty-state:not(.small) { min-height: 46dvh; }
.tr-empty b { color: var(--ink); }
.tr-empty .muted { color: #6b7785; }
/* 棋牌室游戏卡片（手机）：名字一行、说明一行，按钮在右边 */
@media (max-width: 720px) {
  .cd-tile { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "e n b" "e d b"; column-gap: 10px; row-gap: 0; align-items: center; }
  .cd-tile .cd-emoji { grid-area: e; }
  .cd-tile b { grid-area: n; align-self: end; }
  .cd-tile .muted { grid-area: d; align-self: start; font-size: 12px; }
  .cd-tile button { grid-area: b; }
}
/* 捏人：手机上肤色色块一行放得下 */
@media (max-width: 600px) { .mk-swatches { gap: 4px; } .mk-sw { width: 26px; height: 26px; } }
/* 装修：物品一行放不下时，右边渐隐提示还能往右滑 */
#build-items { -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); padding-right: 24px; }
#build-panel button { white-space: nowrap; }
#toast { top: calc(142px + var(--st)); }
#toast, #hint { width: max-content; max-width: calc(100vw - 32px); text-wrap: pretty; } /* 以前从中线起算只有半屏宽，短句也折行 */
@media (max-width: 600px) { body.touch #toast { top: calc(262px + var(--st)); } }
/* 📍 任务带路 */
.tk-row { flex-wrap: wrap; }
.tk-text { flex: 1; min-width: 0; }
#task-card .tk-go { margin-left: auto; padding: 2px 9px; font-size: 12px; font-weight: 700; background: #fff3c4; box-shadow: 0 2px 0 var(--ink); white-space: nowrap; }
#guide-pill { position: fixed; left: 50%; transform: translateX(-50%); top: calc(64px + var(--st)); z-index: 4; display: flex; align-items: center; gap: 8px; width: max-content; max-width: calc(100vw - 24px); background: #ffd23f; color: var(--ink); border: 2px solid var(--ink); border-radius: 99px; box-shadow: 0 3px 0 var(--ink); padding: 4px 6px 4px 14px; font-weight: 800; font-size: 14px; pointer-events: auto; }
#guide-pill.hidden { display: none; }
#guide-pill span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#guide-pill .gp-x { padding: 0 8px; border-radius: 99px; font-size: 13px; box-shadow: none; }
body:has(#dg-hud:not(.hidden)) #guide-pill { top: calc(132px + var(--st)); }
@media (max-width: 600px) { body.touch #guide-pill { top: calc(76px + var(--st)); font-size: 13px; } }
@media (max-height: 500px) { body.touch #guide-pill { top: calc(10px + var(--st)); } }
#task-card { max-width: min(380px, 86vw); }

/* 还没进岛（首页 / 口令页）时，背景里的名牌和地点卡片不显示 */
body:not(.playing) #labels { display: none; }
/* 扫专属二维码进来：谁邀请的 */
#start-invite { display: flex; align-items: center; gap: 10px; text-align: left; background: linear-gradient(90deg, #fff3c4, #fffbea); border: 2px solid #e0b400; border-radius: 14px; padding: 8px 12px; margin: 12px 0 0; }
#start-invite.hidden { display: none; }
#start-invite canvas { width: 44px; height: 44px; border-radius: 50%; background: #eaf6ff; flex-shrink: 0; border: 2px solid #fff; box-shadow: 0 0 0 2px #e0b400; }
#start-invite b { display: block; font-size: 15px; }
#start-invite span { display: block; font-size: 12px; color: #6b5a1e; line-height: 1.5; }
#gate-invite { margin: 0; font-weight: 800; color: #b7791f; }
/* 手机横屏：邀请卡在左，文字和按钮在右，按钮别被挤出屏幕 */
@media (max-height: 500px) {
  .share-box { max-width: min(780px, 96vw); display: grid; grid-template-columns: auto 1fr; grid-template-areas: "img h" "img tip" "img text" "img acts"; column-gap: 16px; align-items: start; align-content: center; text-align: left; padding: 12px 16px; }
  .share-box h1 { grid-area: h; font-size: 20px; margin: 0 0 4px; }
  .share-box #share-img { grid-area: img; max-height: calc(100dvh - 48px); margin: 0; }
  .share-box #share-tip { grid-area: tip; margin: 0 0 6px; }
  .share-box #share-text { grid-area: text; }
  .share-box .start-actions { grid-area: acts; justify-content: flex-start; }
  #share-modal.drawing #share-tip { padding: 10px 0; }
}
@media (max-height: 500px) { .share-box { grid-template-rows: auto auto auto 1fr; } .share-box .start-actions { align-self: start; margin-top: 10px; } }
#ep-phrases { display: grid; grid-template-columns: repeat(3, auto); justify-content: center; gap: 6px; } /* 6 句快捷语：两排各 3 句，不会剩一句单独一行 */
.set-app-acts { justify-content: flex-start; } /* 和设置里其他行一样靠左 */
.nb { white-space: nowrap; } /* 引号里的例子整段不拆行 */
/* 手机横屏：菜单一行 6 个（「我的」正好一排），手机面板 App 一行 3 个、小一点，6 个都看得到 */
@media (max-height: 500px) {
  #menu-panel { width: min(470px, calc(100vw - 20px)); }
  .mn-grid { grid-template-columns: repeat(6, 1fr); }
  .ph-apps { grid-template-columns: repeat(3, 1fr) !important; gap: 8px !important; }
  .ph-app { padding: 6px 4px !important; min-height: 0 !important; }
  .ph-app b { font-size: 22px !important; }
}
/* ===== 手机横屏：人生 / 设置 / 棋牌室 压紧，别被挤坏或切掉 ===== */
@media (max-height: 500px) {
  /* 人生：阶段标签不许被压扁；标题、按钮都缩小 */
  .life-box { gap: 5px; padding: 10px 14px; }
  .life-box h1 { font-size: 18px; }
  #life-head { margin: 0; font-size: 12px; }
  #life-stages { flex-shrink: 0; padding: 2px 2px 4px; }
  .ls { padding: 3px 6px; min-width: 52px; flex-direction: row; gap: 3px; }
  .ls b { font-size: 16px; }
  #life-events { flex: 1 1 auto; min-height: 110px; }
  #life-tags { display: none; }
  #life-grow { padding: 5px 10px; font-size: 13px; flex-shrink: 0; }
  .life-acts { flex-shrink: 0; }
  .life-acts button { padding: 4px 8px; font-size: 13px; }
  /* 设置：左右两栏 */
  .settings-box { display: grid; grid-template-columns: 1fr 1fr; column-gap: 18px; align-items: start; padding: 10px 16px 12px; }
  .settings-box h1, .settings-box .start-actions { grid-column: 1 / -1; }
  .settings-box h1 { font-size: 20px; margin: 0 0 4px; }
  .settings-box .set-row { margin-bottom: 6px; }
  /* 棋牌室：游戏卡片和竖屏一样，名字一行、说明一行、按钮在右 */
  .cd-games { grid-template-columns: repeat(4, 1fr); }
  .cd-tile { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "e n" "e d" "b b"; column-gap: 8px; row-gap: 2px; align-items: center; text-align: left; padding: 6px 10px; }
  .cd-tile .cd-emoji { grid-area: e; font-size: 28px; }
  .cd-tile b { grid-area: n; font-size: 15px; }
  .cd-tile .muted { grid-area: d; font-size: 11px; }
  .cd-tile button { grid-area: b; padding: 3px 10px; }
}
@media (max-height: 500px) { #ed-3d { width: 120px; height: 180px; } }
@media (max-height: 500px) {
  .settings-box { max-width: min(800px, 96vw); width: 100%; }
  .settings-box .seg button { font-size: 13px; padding: 5px 6px; white-space: nowrap; }
  .settings-box #set-info { font-size: 11px; }
  .settings-box .set-app-acts { flex-wrap: nowrap; margin: 4px 0 2px; }
  .settings-box .set-app-acts button { padding: 5px 10px; font-size: 13px; white-space: nowrap; }
  .settings-box .start-actions { margin-top: 2px; }
}

/* 🕹️ 游戏厅 */
.arcade-box { width: min(560px, 100%); height: auto; max-height: 100%; }
#ar-body { flex: 1; min-height: 0; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.ar-games { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.ar-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px 8px 14px; border: 3px solid var(--ink); border-radius: 14px; background: #fffaf0; box-shadow: 0 4px 0 var(--ink); cursor: pointer; }
.ar-tile:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.ar-emoji { font-size: 42px; line-height: 1; }
.ar-name { font-size: 18px; font-weight: 800; }
.ar-best { font-style: normal; font-size: 13px; color: #6b7785; }
.ar-note { text-align: center; margin: 4px 0 0; }
.ar-top { display: flex; align-items: center; gap: 8px; }
.ar-score { font-size: 24px; min-width: 2ch; text-align: right; }
.ar-stage { position: relative; display: flex; justify-content: center; align-items: center; }
.ar-canvas { width: min(100%, 390px, calc((100dvh - 210px) * 0.75)); height: auto; border: 3px solid var(--ink); border-radius: 12px; touch-action: none; user-select: none; -webkit-user-select: none; background: #fff; }
.ar-over { position: absolute; inset: 0; margin: auto; width: min(320px, 92%); max-height: 96%; height: max-content; overflow: auto; background: rgba(255, 255, 255, .96); border: 3px solid var(--ink); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; text-wrap: pretty; }
.ar-over.hidden { display: none; }
.ar-over p { margin: 0; white-space: pre-line; }
.ar-final { font-size: 34px; }
.ar-nb { color: #c0392b; font-weight: 700; }
.ar-bt { font-weight: 700; margin-top: 4px !important; }
.ar-board { list-style: none; margin: 0; padding: 0; width: 100%; font-size: 14px; }
.ar-board li { display: flex; justify-content: space-between; padding: 3px 8px; border-radius: 8px; }
.ar-board li.me { background: #fff1c2; font-weight: 700; }
.ar-acts { display: flex; gap: 8px; margin-top: 6px; }
@media (max-width: 720px) { #ar-body { padding: 10px; } .ar-emoji { font-size: 36px; } }
@media (max-height: 500px) {
  .ar-games { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .ar-tile { padding: 10px 4px 8px; }
  .ar-emoji { font-size: 30px; }
  #ar-body { padding: 8px; gap: 6px; }
  .ar-over { padding: 10px; gap: 4px; }
  .ar-final { font-size: 24px; }
}
@media (max-height: 500px) {
  .arcade-box { width: min(720px, 100%); }
  #ar-body.ar-play { flex-direction: row; align-items: stretch; }
  #ar-body.ar-play .ar-top { flex-direction: column; align-items: stretch; justify-content: flex-start; width: 120px; flex: none; }
  #ar-body.ar-play .ar-top .grow { display: none; }
  #ar-body.ar-play .ar-top .muted { margin-top: 8px; text-align: center; }
  #ar-body.ar-play .ar-score { text-align: center; font-size: 30px; }
  #ar-body.ar-play .ar-stage { flex: 1; min-width: 0; }
  #ar-body.ar-play .ar-canvas { width: calc((100dvh - 92px) * 0.75); max-width: 100%; }
  .ar-over { width: min(400px, 96%); }
  .ar-over .ar-acts { order: -1; margin: 0 0 2px; }
  .ar-over .ar-final { order: -2; }
}
.ar-board li.muted { justify-content: center; }
.hud-right > button.fold { display: none !important; }

/* 🦋 采集按钮 + 🏛️ 博物馆 */
#col-btn { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + var(--sb)); z-index: 4; font-size: 18px; padding: 10px 22px; background: #9be27f; font-weight: 800; }
body.touch #col-btn { display: none !important; }
.museum-box { width: min(760px, 100%); }
#mu-body { flex: 1; min-height: 0; overflow: auto; padding: 12px 14px 16px; display: flex; flex-direction: column; gap: 14px; }
.mu-empty { text-align: center; margin: 40px 0; }
.mu-head { display: flex; flex-direction: column; gap: 8px; }
.mu-titles { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mu-title { background: #fff1c2; border: 2px solid #e0b53a; border-radius: 999px; padding: 2px 10px; font-size: 14px; }
.mu-today { margin: 0; text-wrap: pretty; }
.mu-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.mu-acts button { font-size: 14px; padding: 6px 12px; }
.mu-set { border: 2px solid #eef1f4; border-radius: 14px; padding: 10px 12px; }
.mu-set-h { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.mu-set-h b { font-size: 18px; }
.mu-count { font-weight: 800; color: #2e7d32; }
.mu-reward { font-size: 13px; }
.mu-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.mu-cell { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 8px 2px; min-height: 84px; border-radius: 12px; background: #f4f6f8; border: 2px solid transparent; text-align: center; }
.mu-cell b { font-size: 30px; line-height: 1.1; filter: grayscale(1) opacity(.45); }
.mu-cell.mine { background: #fffaf0; border-color: #e9ddca; }
.mu-cell.mine b { filter: none; }
.mu-cell.rare.mine { border-color: #e0b53a; box-shadow: 0 0 0 2px #fff1c2 inset; }
.mu-cell .mu-n { font-size: 13px; font-weight: 700; word-break: keep-all; }
.mu-cell i { font-style: normal; font-size: 11px; color: #8a96a3; }
.mu-cell.unknown b { filter: none; opacity: .5; }
.mu-done { margin: 8px 0 0; font-size: 13px; }
@media (max-width: 720px) { #mu-body { padding: 10px; gap: 10px; } .mu-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; } .mu-cell { padding: 6px 2px; min-height: 76px; } .mu-cell b { font-size: 26px; } .mu-reward { flex-basis: 100%; } }
@media (max-height: 500px) { .museum-box { width: min(900px, 100%); } .mu-grid { grid-template-columns: repeat(8, 1fr); } .mu-cell { min-height: 70px; } .mu-cell b { font-size: 24px; } }

/* ❓ 熟人问答 */
.cd-quiz { display: flex; flex-direction: column; gap: 10px; flex: 1; min-height: 0; width: min(720px, 100%); margin: 0 auto; }
.qz-q { font-size: 22px; font-weight: 800; text-align: center; white-space: pre-line; text-wrap: pretty; padding: 14px 10px; background: #fffaf0; border: 3px solid var(--ink); border-radius: 14px; }
.qz-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qz-opt { display: flex; align-items: center; gap: 10px; text-align: left; padding: 12px 12px; font-size: 17px; font-weight: 700; border-radius: 12px; min-height: 58px; position: relative; }
.qz-opt:disabled { opacity: 1; cursor: default; }
.qz-l { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 14px; }
.qz-t { flex: 1; min-width: 0; }
.qz-opt.mine { background: #fff1c2; }
.qz-opt.right { background: #c9f2c0; border-color: #2e7d32; }
.qz-opt.wrong { background: #ffd6d6; border-color: #c0392b; }
.qz-who { display: flex; gap: 2px; flex-wrap: wrap; justify-content: flex-end; max-width: 40%; }
.qz-who canvas, .qz-who .cd-noface { border-radius: 50%; }
.qz-ok { color: #2e7d32; } .qz-no { color: #c0392b; }
.cd-quiz .cd-chat .cd-log { max-height: 90px; }
@media (max-width: 720px) { .qz-q { font-size: 19px; padding: 10px 8px; } .qz-opts { grid-template-columns: 1fr; gap: 8px; } .qz-opt { min-height: 48px; padding: 8px 10px; font-size: 16px; } }
@media (max-height: 500px) { .cd-quiz { gap: 6px; } .qz-q { font-size: 17px; padding: 6px 8px; } .qz-opt { min-height: 40px; padding: 6px 10px; font-size: 15px; } .cd-quiz .cd-chat { display: none; } }
.ar-lb { border: 2px solid #eef1f4; border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.ar-lb-h { font-size: 16px; }
.ar-lb-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.ar-lb-tabs button { font-size: 13px; padding: 4px 10px; }
.ar-lb-tabs button.on { background: #ffd24d; }
.ar-lb .ar-board { max-height: 220px; overflow: auto; }
@media (max-height: 500px) { .ar-lb { padding: 6px 10px; gap: 4px; } .ar-lb .ar-board { max-height: 90px; } }
.qz-bar { height: 8px; border-radius: 99px; background: #eef1f4; overflow: hidden; }
.qz-bar i { display: block; height: 100%; background: #5fd0e4; border-radius: 99px; }
.qz-bar i.hot { background: #ff7b5c; }
.ar-lb-tabs { display: grid; grid-template-columns: repeat(4, 1fr); }
.ar-lb-tabs button { padding: 4px 2px; white-space: nowrap; }
@media (max-width: 1100px) { .wx-x { display: none; } } body.touch .wx-x { display: none; }
.mn-item { position: relative; }
.mn-item.has-new::after { content: attr(data-n); position: absolute; top: 2px; right: 4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: #e74c3c; color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; border: 2px solid #fff; }
.mn-new { width: 100%; margin: 0 0 6px; padding: 8px 10px; border-radius: 12px; background: #fff1c2; border: 2px solid #e0b53a; font-weight: 700; font-size: 14px; text-align: left; }
/* 📤 告诉 TA */
#poke-pill { position: fixed; left: 50%; transform: translateX(-50%); top: calc(108px + var(--st)); z-index: 5; display: flex; align-items: center; gap: 6px; width: max-content; max-width: calc(100vw - 24px); background: #fff; color: var(--ink); border: 2px solid var(--ink); border-radius: 99px; box-shadow: 0 3px 0 var(--ink); padding: 6px 6px 6px 14px; font-weight: 800; font-size: 14px; cursor: pointer; animation: pokeIn .35s ease-out; }
#poke-pill.hidden { display: none; }
#poke-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#poke-pill .x { flex: none; padding: 2px 8px; font-size: 12px; border-radius: 99px; }
@keyframes pokeIn { from { transform: translate(-50%, -12px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
#labels .label.star .name { background: #ffd24d; color: #1f2933; border-color: #1f2933; font-weight: 800; }
#labels .label.star { z-index: 3; }
