:root {
  --ink: #2C2C2A;
  --ink2: #5F5E5A;
  --ink3: #8A8880;
  --honey: #EF9F27;
  --honey-d: #BA7517;
  --card: #FFFFFF;
  --line: #E7E2D6;
  --r: 18px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  height: 100%;
  overflow: hidden;
  touch-action: manipulation;
  overscroll-behavior: none;
}
body {
  background: #E4EFF8;
  color: var(--ink);
  font: 400 15px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC",
        "HarmonyOS Sans SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
  user-select: none;
  -webkit-user-select: none;
}

.app {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
}

.stage { position: absolute; inset: 0; }
#game {
  display: block;
  width: 100%; height: 100%;
  touch-action: none;
}

.home-back {
  position: absolute;
  left: calc(env(safe-area-inset-left) + 12px);
  top: calc(env(safe-area-inset-top) + 10px);
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(255,255,255,.72);
  color: var(--ink2);
  font-size: 20px; line-height: 1;
  text-decoration: none;
  backdrop-filter: blur(6px);
  z-index: 13;
  transition: opacity .16s ease;
}
.home-back:active { transform: scale(.94); }

.app.paneling .topbar,
.app.paneling .home-back {
  opacity: 0;
  pointer-events: none;
}

.hud {
  position: absolute;
  left: calc(env(safe-area-inset-left) + 16px);
  top: calc(env(safe-area-inset-top) + 58px);
  pointer-events: none;
  z-index: 2;
}
.score {
  font-size: 44px; font-weight: 500; line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
}
.best {
  margin-top: 4px;
  font-size: 12px; color: var(--ink3);
}
.best b { font-weight: 500; color: var(--ink2); }
.combo {
  margin-top: 6px;
  font-size: 12px; font-weight: 500;
  color: var(--honey-d);
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity .18s, transform .18s;
}
.combo.on { opacity: 1; transform: none; }

.topbar {
  position: absolute;
  right: calc(env(safe-area-inset-right) + 12px);
  top: calc(env(safe-area-inset-top) + 10px);
  display: flex; gap: 8px;
  z-index: 13;
  transition: opacity .16s ease;
}
.icon-btn {
  width: 40px; height: 40px;
  border: 0; border-radius: 50%;
  background: rgba(255,255,255,.72);
  color: var(--ink2);
  font-size: 17px; line-height: 1;
  font-family: inherit;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.icon-btn:active { transform: scale(.94); }

@media (max-width: 360px) {
  .topbar { gap: 6px; }
  .icon-btn { width: 36px; height: 36px; font-size: 15px; }
}

.hint {
  position: absolute;
  left: 50%; bottom: calc(env(safe-area-inset-bottom) + 48px);
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 12px 20px;
  max-width: calc(100vw - 32px);
  border-radius: 14px;
  background: rgba(255,255,255,.86);
  box-shadow: 0 6px 22px rgba(70,60,40,.10);
  pointer-events: none;
  transition: opacity .25s;
  z-index: 2;
}
.hint[hidden] { display: none; }
.hint b { font-size: 14px; font-weight: 500; white-space: nowrap; }
.hint span { font-size: 12px; color: var(--ink3); text-align: center; }

.toast {
  position: absolute;
  left: 50%; top: 34%;
  transform: translate(-50%, 6px);
  font-size: 22px; font-weight: 500;
  color: var(--honey-d);
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s, transform .3s;
  z-index: 4;
}
.toast.on { opacity: 1; transform: translate(-50%, -6px); }

.egg {
  position: absolute;
  left: 50%; top: 15%;
  width: 132px; height: 132px;
  margin-left: -66px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 26px rgba(40,36,24,.28);
  pointer-events: none;
  z-index: 5;
  animation: eggRise 2.2s cubic-bezier(.16,.84,.3,1) forwards;
}
.egg img {
  display: block; width: 100%; height: 100%;
  object-fit: cover; object-position: center bottom;
}
@keyframes eggRise {
  0%   { opacity: 0; transform: translateY(26px) scale(.72) rotate(-6deg); }
  14%  { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
  72%  { opacity: 1; transform: translateY(-40px) scale(1) rotate(0); }
  100% { opacity: 0; transform: translateY(-86px) scale(.94) rotate(2deg); }
}
@media (prefers-reduced-motion: reduce) {
  .egg { animation: eggFade 2.2s ease forwards; }
}
@keyframes eggFade {
  0% { opacity: 0 } 14% { opacity: 1 } 80% { opacity: 1 } 100% { opacity: 0 }
}

.over {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(40,44,52,.28);
  backdrop-filter: blur(3px);
  z-index: 10;
  animation: fade .2s ease;
}
.over[hidden] { display: none; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

.over-card {
  width: min(340px, 88vw);
  max-height: 88vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  border-radius: 22px;
  background: var(--card);
  box-shadow: 0 18px 48px rgba(40,36,24,.18);
  text-align: center;
  animation: pop .24s cubic-bezier(.2,1.2,.4,1);
}
@keyframes pop { from { transform: scale(.94); opacity: 0 } to { transform: none; opacity: 1 } }

.meme {
  flex: 0 0 auto;
  background: #EFE4D7;
  line-height: 0;
}
.meme[hidden] { display: none; }
.meme img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 42vh;
  object-fit: cover;
  object-position: center bottom;
}

.over-body { padding: 14px 20px 16px; }

.over-line {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--ink3);
  letter-spacing: .5px;
}
.over-line .over-score {
  font-size: 30px;
  font-weight: 500;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
  margin: 0 2px;
  vertical-align: -3px;
}
.over-tag {
  display: inline-block;
  margin: 8px 0 0;
  padding: 3px 10px;
  border-radius: 999px;
  background: #FFF4E2;
  color: var(--honey-d);
  font-size: 11px;
}
.over-tag[hidden] { display: none; }
.over-score { font-variant-numeric: tabular-nums; }
.over-meta { margin: 0 0 14px; font-size: 11px; color: var(--ink3); min-height: 16px; }
.over-meta b { font-weight: 500; color: var(--ink2); }

.big-btn {
  width: 100%;
  padding: 13px 0;
  border: 0; border-radius: 14px;
  background: var(--honey);
  color: #fff;
  font-size: 15px; font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}
.big-btn:active { transform: scale(.98); background: var(--honey-d); }
.over .big-btn { padding: 11px 0; border-radius: 12px; font-size: 14px; }

.text-btn {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 36px; padding: 0 12px;
  margin-top: 12px;
  border: 1.5px solid var(--honey);
  border-radius: 11px;
  background: transparent;
  color: var(--honey-d);
  font-family: inherit; font-size: 13px; font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}
.text-btn:active { background: rgba(239,159,39,.10); transform: scale(.98); }
.over-foot {
  display: flex; align-items: center; justify-content: center;
  margin-top: 12px;
}
.over-trophy {
  width: 34px; height: 34px;
  font-size: 17px;
}

.lb { margin: 0 0 12px; }
.lb-row { display: flex; gap: 8px; }
.lb-nick {
  flex: 1 1 auto; min-width: 0;
  height: 34px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #FAF7F0;
  font-family: inherit; font-size: 16px; color: var(--ink);
}
.lb-nick:focus {
  outline: none; border-color: var(--honey);
  box-shadow: 0 0 0 3px rgba(239,159,39,0.18);
}
.lb-send {
  flex: none; height: 34px; padding: 0 13px;
  border: 0; border-radius: 10px; cursor: pointer;
  background: var(--honey); color: #fff;
  font-family: inherit; font-size: 13px; font-weight: 500;
}
.lb-send:active { transform: scale(.97); }
.lb-send:disabled { opacity: .55; cursor: default; }
.lb-msg { margin: 6px 0 0; min-height: 14px; font-size: 11px; color: var(--ink3); }
.lb-msg.bad { color: #B4563A; }

.lb-list { margin: 14px 0 0; padding: 0; list-style: none; }
.lb-list li {
  display: flex; align-items: baseline; gap: 10px;
  padding: 8px 2px; font-size: 14px;
  border-bottom: 1px solid #F2EDE2;
}
.lb-list li:last-child { border-bottom: 0; }
.lb-list .r {
  flex: none; width: 20px; text-align: right;
  font-size: 12px; color: var(--ink3); font-variant-numeric: tabular-nums;
}
.lb-list .n { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-list .s { flex: none; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--honey-d); }
.lb-list li.empty { color: var(--ink3); font-size: 12px; justify-content: center; }
.lb-list li.me { background: rgba(239,159,27,.12); border-radius: 7px; }
.lb-list li.me .n { color: var(--honey-d); font-weight: 500; }
.lb-list li.me .s { color: var(--honey-d); }

.setpanel {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(40,44,52,.28);
  backdrop-filter: blur(3px);
  z-index: 20;
}
.setpanel[hidden] { display: none; }
.boardpanel {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(40,44,52,.28);
  backdrop-filter: blur(3px);
  z-index: 20;
  animation: fade .2s ease;
}
.boardpanel[hidden] { display: none; }
.board-card {
  width: min(320px, 86vw);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.board-card > .board-cap,
.board-card > .board-tabs,
.board-card > .lb-msg,
.board-card > .big-btn { flex: none; }

.board-cap {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  margin-bottom: 4px;
}
.board-cap b {
  font-size: 12px; font-weight: 500; letter-spacing: .12em;
  color: var(--honey-d);
  background: #FFF7E8;
  border: 1px solid var(--honey);
  border-radius: 999px;
  padding: 4px 14px;
}
.board-cap em { font-size: 11px; font-style: normal; color: var(--ink3); }
.board-tabs {
  display: flex; gap: 4px;
  margin-top: 12px;
  padding: 3px;
  border-radius: 12px;
  background: #F4F0E6;
}
.board-tab {
  flex: 1 1 0; min-width: 0;
  height: 32px;
  border: 0; border-radius: 9px;
  background: transparent;
  font-family: inherit; font-size: 13px; color: var(--ink3);
  cursor: pointer;
  transition: background .14s, color .14s;
}
.board-tab.on {
  background: #fff;
  color: var(--ink);
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(60,50,30,.12);
}
.board-card .lb-list {
  margin-top: 10px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.board-card .big-btn { margin-top: 6px; }
.set-card {
  width: min(320px, 86vw);
  padding: 20px;
  border-radius: 20px;
  background: var(--card);
  box-shadow: 0 18px 48px rgba(40,36,24,.18);
  max-height: min(86vh, calc(100dvh - 120px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.set-head { display: flex; align-items: center; justify-content: space-between; }
.set-head h2 { margin: 0; font-size: 16px; font-weight: 500; }
.set-head .icon-btn { background: #F3F0E8; width: 32px; height: 32px; font-size: 18px; }

.set-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin: 16px 0 6px;
  padding: 14px;
  border-radius: 14px;
  background: #FAF7F0;
  cursor: pointer;
}
.set-row b { display: block; font-size: 14px; font-weight: 500; }
.set-row em {
  display: block; margin-top: 3px;
  font-size: 12px; font-style: normal; color: var(--ink3); line-height: 1.45;
}
.set-row input[type="checkbox"] {
  flex: 0 0 auto;
  width: 44px; height: 26px;
  appearance: none; -webkit-appearance: none;
  border-radius: 999px;
  background: #D8D4C8;
  position: relative;
  transition: background .18s;
  cursor: pointer;
}
.set-row input[type="checkbox"]::after {
  content: '';
  position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform .18s;
}
.set-row input[type="checkbox"]:checked { background: var(--honey); }
.set-row input[type="checkbox"]:checked::after { transform: translateX(18px); }

.set-foot {
  margin: 10px 2px 0;
  font-size: 12px; line-height: 1.6; color: var(--ink3);
}

.set-row-btn { cursor: default; }
.fb-card { width: min(320px, 86vw); }
.fb-text, .fb-contact {
  display: block; width: 100%; box-sizing: border-box;
  margin-top: 12px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 12px;
  background: #FAF7F0;
  font-family: inherit; font-size: 16px; color: var(--ink);
  resize: none;
}
.fb-text:focus, .fb-contact:focus {
  outline: none; border-color: var(--honey);
  box-shadow: 0 0 0 3px rgba(239,159,39,0.18);
}
.fb-hint, .fb-msg { margin: 8px 2px 0; min-height: 16px; font-size: 12px; color: var(--ink3); }
.fb-msg:empty { min-height: 0; }
.fb-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.fb-actions .text-btn { margin-top: 0; }

.sfx-card { width: min(360px, 92vw); max-height: 84vh; display: flex; flex-direction: column; overflow: hidden; }
.sfx-list {
  margin-top: 12px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
  min-height: 0;
}

.sfx-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.sfx-tab {
  position: relative;
  flex: 1 1 auto; min-width: 64px;
  padding: 9px 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #FAF7F0;
  color: var(--ink2);
  font-family: inherit; font-size: 12px; font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.sfx-tab.on { background: var(--honey); border-color: var(--honey); color: #fff; }
.sfx-tab i {
  position: absolute; top: 4px; right: 5px;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--honey-d);
}
.sfx-tab.on i { background: #fff; }

.sfx-note { margin: 11px 2px 9px; font-size: 11px; line-height: 1.5; color: var(--ink3); }
.sfx-note b { color: var(--ink2); font-weight: 500; }
.sfx-fixed { margin-bottom: 2px; }

.sfx-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sfx-cat { width: 100%; margin: 6px 0 2px; font-size: 11px; color: var(--ink3); }
.sfx-chip {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #FAF7F0;
  color: var(--ink2);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.sfx-chip:active { transform: scale(.97); }
.sfx-chip.on {
  background: var(--honey);
  border-color: var(--honey);
  color: #fff;
  font-weight: 500;
  box-shadow: 0 2px 6px rgba(239,159,39,0.28);
}
.sfx-chip .d { font-size: 10px; opacity: .7; }
.sfx-chip .d.cut { opacity: 1; color: #B4563A; font-variant-numeric: tabular-nums; }
.sfx-chip.on .d.cut { color: #FFF0E6; }
/* 多选（2026-10-24）：未选中的 chip 用虚线边 —— 现在它们都是**可点的开关**，
   不再只是单选列表里的一条，得和纯展示的标签区分开。 */
.sfx-chip[aria-pressed="false"] { border-style: dashed; }
/* 已选计数：多选后必须一眼看到「这个事件现在绑了几条」 */
.sfx-count { margin: 0 2px 8px; }
.sfx-count b { color: var(--honey-d, #BA7517); font-weight: 600; }
.sfx-warn {
  margin: 0 0 10px; padding: 8px 10px;
  border-radius: 10px;
  background: #FDF1EC;
  color: #A24E33;
  font-size: 11px; line-height: 1.55;
  text-align: left;
}
.sfx-foot { display: flex; justify-content: center; margin: 8px 0 0; }
.sfx-reset { margin-top: 0; font-size: 12px; }

.cat-card {
  width: min(340px, 90vw);
  max-height: 84vh;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.cat-tip { margin: 8px 2px 0; font-size: 12px; line-height: 1.5; color: var(--ink3); }
.cat-grid {
  margin-top: 12px;
  padding-bottom: 4px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
  min-height: 0;
}
.cat-item {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px;
  padding: 8px 4px 6px;
  border: 2px solid transparent;
  border-radius: 14px;
  background: #FAF7F0;
  color: var(--ink2);
  font-family: inherit; font-size: 11px; line-height: 1.2;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.cat-item img { display: block; width: 100%; height: 52px; object-fit: contain; }
.cat-item.on {
  border-color: var(--honey);
  background: #FFF7E8;
  color: var(--honey-d);
  font-weight: 500;
}
.cat-item:active { transform: scale(.96); }
.cat-low {
  position: absolute; top: 4px; right: 4px;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(255,255,255,.92);
  border: .5px solid var(--line);
  color: var(--ink3);
  font-size: 9px; font-style: normal; line-height: 1.4;
  font-weight: 400;
}

/* ── 选猫彩蛋：密码锁 + 隐藏人物徽章（v1，2026-10-30） ── */
.cat-item-vip { background: #FFF6E4; }
.cat-item-vip.on { background: #FFEFD2; }
.cat-vip-badge {
  position: absolute; top: 4px; left: 4px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--honey, #E8A33D);
  color: #fff;
  font-size: 9px; font-style: normal; line-height: 1.4;
  font-weight: 500;
}
.cat-vip {
  margin: 10px 0 2px;
  padding-top: 10px;
  border-top: .5px dashed var(--line, #E4DDD0);
  display: flex; flex-direction: column; align-items: center;
  flex: none;
}
.cat-vip-open {
  width: 100%;
  padding: 9px 0;
  border: 1px dashed var(--line, #E4DDD0);
  border-radius: 12px;
  background: #FAF7F0;
  color: var(--ink3, #9A9384);
  font-family: inherit; font-size: 12px; letter-spacing: .42em;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.cat-vip-open:active { transform: scale(.98); }
.cat-vip-done {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--honey-d, #BA7517);
}
.cat-vip-pad {
  width: 100%;
  padding: 10px 0 0;
  display: flex; flex-direction: column; align-items: center;
}
.cat-vip-pad[hidden] { display: none; }
.vip-dots { display: flex; gap: 10px; margin: 2px 0 10px; }
.vip-dots i {
  width: 11px; height: 11px;
  border-radius: 50%;
  border: 1.5px solid var(--line, #E4DDD0);
  background: #fff;
  transition: background .1s, border-color .1s, transform .1s;
}
.vip-dots i.on {
  background: var(--honey, #E8A33D);
  border-color: var(--honey, #E8A33D);
  transform: scale(1.12);
}
.vip-keys {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: min(232px, 100%);
}
.vip-key {
  padding: 10px 0;
  border: .5px solid var(--line, #E4DDD0);
  border-radius: 11px;
  background: #fff;
  color: var(--ink2, #5C5648);
  font-family: inherit; font-size: 16px; font-weight: 500;
  cursor: pointer;
  transition: background .1s;
}
.vip-key:active { background: #FFF3DC; }
.vip-key-fn { font-size: 13px; color: var(--ink3, #9A9384); background: #FAF7F0; }
.vip-msg {
  min-height: 16px;
  margin: 8px 0 0;
  font-size: 11px; line-height: 1.4;
  color: var(--ink3, #9A9384);
  text-align: center;
}
.vip-msg.bad { color: #C2503C; }
@keyframes vip-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}
.cat-vip-pad.shake { animation: vip-shake .3s ease; }
