:root {
  /* 派对卡牌：钴蓝底 + 黄/粉卡片 + 粗黑描边和硬阴影；单列手机布局 */
  color-scheme: light;
  --ground: #2E4BE0;
  --ink: #121212;
  --card: #FFD43B;
  --pink: #FF6FAE;
  --paper: #FFFFFF;
  --muted: #4A4A4A;
  --display: 'ZCOOL QingKe HuangYou', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --latin: 'Archivo Black', 'Arial Black', sans-serif;
  --body: 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
}
html[lang="en"] { --display: 'Archivo Black', 'Arial Black', sans-serif; }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--ground);
  color: var(--paper);
  font-family: var(--body);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
#app { height: 100%; max-width: 480px; margin: 0 auto; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: not-allowed; opacity: 0.35; }
:focus-visible { outline: 3px solid var(--paper); outline-offset: 3px; }
.panel :focus-visible, .card :focus-visible { outline-color: var(--ink); }
[tabindex="-1"]:focus { outline: none; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* 字体只有一个字重：不让浏览器伪加粗；字体没加载时系统字体用粗体 */
.wordmark, .title, .word, .btn--primary, .back-mark {
  font-family: var(--display);
  font-weight: 900;
  font-synthesis: none;
}

/* ---------- 页面骨架 ---------- */
.screen {
  min-height: 100%;
  padding: max(16px, env(safe-area-inset-top)) 18px max(26px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.screen--fit { height: 100%; }
.push { margin-top: auto; }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 56px; }
.brand { display: flex; align-items: center; gap: 8px; }
.wordmark { margin: 0; font-size: 50px; line-height: 1; }
html[lang="en"] .wordmark { font-size: 34px; }
.title { margin: 0; font-size: 32px; line-height: 1.15; overflow-wrap: anywhere; }
html[lang="en"] .title { font-size: 24px; }
.sticker {
  transform: rotate(-6deg);
  background: var(--card);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 6px;
  padding: 3px 8px;
  font-family: var(--latin);
  font-size: 13px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.round-tag { font-family: var(--latin); font-size: 15px; letter-spacing: 0.04em; white-space: nowrap; }
.lead { margin: 0; font-size: 16px; font-weight: 700; }
.fine { margin: 0; text-align: center; font-size: 13px; font-weight: 500; }

/* ---------- 语言切换 ---------- */
.seg { display: flex; flex-shrink: 0; background: var(--paper); border: 2.5px solid var(--ink); border-radius: 999px; padding: 2px; }
.seg button { min-width: 44px; height: 40px; border: 0; border-radius: 999px; background: transparent; color: var(--ink); font-size: 16px; font-weight: 900; }
.seg button.latin { font-family: var(--latin); font-weight: 400; font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--card); }
.seg :focus-visible { outline-color: var(--ink); }

/* ---------- 白色面板 ---------- */
.panel {
  background: var(--paper);
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: 5px 5px 0 var(--ink);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.panel--row { flex-direction: row; justify-content: space-between; align-items: center; padding: 12px 16px; }
.panel h2 { margin: 0; font-size: 18px; font-weight: 900; }
.panel-head { display: flex; align-items: center; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.note { margin: 0; font-size: 13px; font-weight: 500; color: var(--muted); }
.badge {
  min-width: 26px; height: 26px; padding: 0 6px; border-radius: 999px;
  background: var(--ink); color: var(--paper);
  font-family: var(--latin); font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}

/* 玩家 */
.players { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.player {
  display: flex; align-items: center; height: 48px; padding-left: 5px;
  border: 2.5px solid var(--ink); border-radius: 999px; background: var(--paper);
}
.player:focus-within { outline: 3px solid var(--ink); outline-offset: 2px; }
.player input {
  flex: 1; min-width: 0; height: 100%; padding: 0 0 0 8px;
  border: 0; background: transparent; color: var(--ink);
  font-size: 16px; font-weight: 700;
}
.player input:focus-visible { outline: none; }
.player input::placeholder { color: var(--muted); font-weight: 500; opacity: 1; }
.avatar {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid var(--ink); background: var(--card);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-size: 16px; line-height: 1;
}
.avatar--pink { background: var(--pink); }
.remove {
  flex-shrink: 0; width: 44px; height: 100%; border: 0; border-radius: 999px; background: transparent;
  display: flex; align-items: center; justify-content: center;
}
.add {
  height: 48px; border: 2.5px dashed var(--ink); border-radius: 999px; background: transparent; color: var(--ink);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 16px; font-weight: 900;
}

/* 卧底人数 */
.stepper { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.round-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 2.5px solid var(--ink); background: var(--paper);
  display: flex; align-items: center; justify-content: center;
}
.round-btn--accent { background: var(--card); }
.count { min-width: 28px; text-align: center; font-family: var(--latin); font-size: 34px; line-height: 1; }

/* 词库 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  height: 44px; padding: 0 16px; border: 2.5px solid var(--ink); border-radius: 12px;
  background: var(--paper); color: var(--ink);
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 16px; font-weight: 700;
}
.chip .check { display: none; }
.chip[aria-pressed="true"] { background: var(--card); font-weight: 900; padding: 0 14px; }
.chip[aria-pressed="true"] .check { display: block; }

/* 开关 */
.switch {
  flex-shrink: 0; width: 60px; height: 36px; padding: 3px;
  border: 2.5px solid var(--ink); border-radius: 999px; background: var(--paper);
  display: flex; justify-content: flex-start; align-items: center;
}
.switch[aria-checked="true"] { background: var(--card); justify-content: flex-end; }
.switch span { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); }

/* ---------- 按钮 ---------- */
/* position: relative 让按钮画在旋转的牌上层，牌角不会盖住按钮 */
.btn {
  position: relative;
  min-height: 64px; padding: 6px 16px;
  border: 3px solid var(--ink); border-radius: 18px; box-shadow: 6px 6px 0 var(--ink);
  background: var(--paper); color: var(--ink);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 19px; font-weight: 900; text-align: center;
}
.btn:active { transform: translate(3px, 3px); box-shadow: 3px 3px 0 var(--ink); }
.btn--primary { background: var(--card); font-size: 28px; }
html[lang="en"] .btn--primary { font-size: 21px; }
.btn svg { flex-shrink: 0; }
.text-btn {
  position: relative;
  align-self: center; min-height: 44px; padding: 0 18px;
  border: 2px solid var(--paper); border-radius: 999px; background: transparent; color: var(--paper);
  font-size: 14px; font-weight: 700;
}
.actions { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 12px; }

/* ---------- 进度 ---------- */
.progress { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.progress-num { font-family: var(--latin); font-size: 18px; white-space: nowrap; }
.dots { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; max-width: 120px; }
.dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--paper); }
.dot--done { background: var(--paper); }
.dot--now { background: var(--card); border-color: var(--ink); }

/* ---------- 牌 ---------- */
.deck { flex: 1; min-height: 0; display: grid; place-items: center; container-type: size; }
.deck > * { grid-area: 1 / 1; }
/* 满尺寸 290×430；剩余高度不够时等比缩小（留 40px 给旋转和阴影） */
.card {
  width: min(290px, 74vw, (100cqh - 40px) * 29 / 43);
  aspect-ratio: 29 / 43;
  border: 3px solid var(--ink);
  border-radius: 22px;
  container-type: inline-size;
}
.card--ghost-pink { background: var(--pink); transform: translate(18px, 10px) rotate(7deg); }
.card--ghost-white { background: var(--paper); transform: translate(-14px, 6px) rotate(-6deg); }
.card--face {
  position: relative;
  display: flex;
  padding: 14px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
  transform: rotate(-2deg);
  animation: deal 0.22s ease-out;
}
.card--imposter { background: var(--pink); }
.card--back { background: var(--ink); color: var(--card); }
@keyframes deal {
  from { transform: rotate(-8deg) scale(0.92); }
  to { transform: rotate(-2deg) scale(1); }
}
/* 牌里的尺寸都用 em：牌满尺寸时 1em = 16px，牌缩小时内容一起缩小 */
.card-inner {
  flex: 1;
  position: relative;
  border: 2px dashed currentColor;
  border-radius: 14px;
  padding: 2.5em 0.75em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75em;
  text-align: center;
  min-height: 0;
}
.card .card-inner { font-size: calc(100cqw * 16 / 290); }
.card-inner > svg { width: 4em; height: 2.25em; }
.corner { position: absolute; font-family: var(--latin); font-size: 1.375em; line-height: 1; }
.corner--tl { top: 0.45em; left: 0.55em; }
.corner--br { bottom: 0.45em; right: 0.55em; transform: rotate(180deg); }
.word { margin: 0; line-height: 1.05; overflow-wrap: anywhere; }
.pill {
  background: var(--ink); color: var(--card);
  border-radius: 999px; padding: 0.375em 1.125em;
  font-size: 1em; font-weight: 900; letter-spacing: 0.1em;
}
.card-note { margin: 0; font-size: max(0.9375em, 12px); font-weight: 700; }
.back-mark { font-size: 7.5em; line-height: 1; }
.back-logo { font-family: var(--latin); font-size: 1.125em; letter-spacing: 0.12em; }

/* ---------- 讨论 / 揭晓 ---------- */
.grow { flex: 1; min-height: 0; }
.panel--center { align-items: center; justify-content: center; text-align: center; gap: 14px; padding: 24px 20px; }
.label { margin: 0; font-size: 15px; font-weight: 900; letter-spacing: 0.1em; }
.body-text { margin: 0; max-width: 30em; font-size: 15px; font-weight: 500; line-height: 1.6; color: var(--muted); }
.banner {
  display: flex; padding: 14px;
  border: 3px solid var(--ink); border-radius: 22px; box-shadow: 8px 8px 0 var(--ink);
  color: var(--ink);
}
.banner--pink { background: var(--pink); transform: rotate(1.5deg); min-height: 220px; }
.banner .card-inner { padding: 20px 12px; }
.banner--yellow { background: var(--card); flex-direction: column; gap: 8px; padding: 14px 18px 16px; }
.banner-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.banner--yellow .pill { padding: 4px 14px; font-size: 14px; }

@media (prefers-reduced-motion: reduce) {
  .card--face { animation: none; }
  .btn:active { transform: none; }
}
