:root {
  --primary: #6c5ce7;
  --primary-dark: #5a4bd1;
  --bg: #f4f5fb;
  --card: #ffffff;
  --text: #1f2333;
  --muted: #8a8fa3;
  --border: #e8eaf2;
  --red: #ff5a5f;
  --blue: #4a7dff;
  --green: #22b573;
  --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
}

.shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 20px 16px 110px;
}

/* ---------- 通用 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 12px rgba(40, 44, 80, 0.05);
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
h1 { font-size: 28px; font-weight: 700; margin: 0; }
h2 { font-size: 17px; font-weight: 600; margin: 0; }
.sub { color: var(--muted); font-size: 14px; margin: 6px 0 0; }

.field-label { display: block; font-size: 13px; color: var(--muted); margin: 16px 0 8px; }

.input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 16px;
  color: var(--text);
  background: #fafbfe;
  outline: none;
  transition: border .15s;
  margin-bottom: 12px;
}
.input:focus { border-color: var(--primary); background: #fff; }

.btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 10px;
  transition: transform .05s, opacity .15s;
  color: var(--text);
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-dark); }
.btn-ghost { background: #f0f1f8; color: var(--text); }
.btn-sm { width: auto; display: inline-block; padding: 8px 14px; font-size: 14px; margin-bottom: 0; }

.hint { color: var(--muted); font-size: 13px; margin: 8px 0 0; text-align: center; }
.hint b { color: var(--text); }
.wait { color: var(--muted); }
.center { text-align: center; }

.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 8px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- 首页 ---------- */
.logo { text-align: center; padding: 32px 0 24px; }
.logo-badge {
  width: 64px; height: 64px; margin: 0 auto 14px;
  background: var(--primary); color: #fff;
  border-radius: 20px; font-size: 30px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.join-row { display: flex; gap: 10px; }
.join-row .input { flex: 1; }
.join-row .btn { width: 90px; }

/* ---------- 大厅 ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.topbar-left { display: flex; align-items: baseline; gap: 8px; }
.room-badge { font-size: 13px; color: var(--muted); }
.room-num { font-size: 24px; font-weight: 700; letter-spacing: 3px; color: var(--primary); }

.qr-card { text-align: center; }
.qr-box {
  width: 180px; height: 180px; margin: 8px auto;
  background: #fff; border: 1px solid var(--border);
  border-radius: 12px; padding: 8px;
  display: flex; align-items: center; justify-content: center;
}
.qr-box img, .qr-box canvas { width: 164px !important; height: 164px !important; }

.pill { background: #f0f1f8; color: var(--muted); font-size: 13px; padding: 3px 10px; border-radius: 20px; }

.player-list { list-style: none; margin: 0 0 16px; padding: 0; }
.player-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.player-item:last-child { border-bottom: none; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: #e9e6ff; color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; flex-shrink: 0;
}
.pname { flex: 1; font-size: 16px; font-weight: 500; }
.tag-host, .tag-offline, .tag-me {
  font-size: 11px; padding: 2px 7px; border-radius: 10px; margin-left: 6px;
}
.tag-host { background: #ffe9a8; color: #a07400; }
.tag-offline { background: #f0f1f8; color: var(--muted); }
.tag-me { background: #e9e6ff; color: var(--primary); }

/* ---------- 房主离线提示 ---------- */
.hostoffline {
  display: flex; align-items: center; gap: 9px;
  background: #fff6e5; border: 1px solid #ffe1a6; color: #a07400;
  border-radius: 12px; padding: 11px 14px; margin-bottom: 16px;
  font-size: 14px;
}
.hostoffline-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #f0a300; flex-shrink: 0;
  animation: hostpulse 1.4s ease-in-out infinite;
}
.hostoffline-text { line-height: 1.4; }
.hostoffline-text b { font-variant-numeric: tabular-nums; letter-spacing: .5px; }
@keyframes hostpulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .25; }
}

/* ---------- 设置 ---------- */
.stepper { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }
.step-btn {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--border);
  background: #fafbfe; font-size: 22px; color: var(--text); cursor: pointer;
}
.step-val { font-size: 22px; font-weight: 700; min-width: 40px; text-align: center; }
.seg { display: flex; background: #f0f1f8; border-radius: 12px; padding: 4px; margin-bottom: 8px; }
.seg-btn {
  flex: 1; border: none; background: transparent; padding: 10px;
  font-size: 15px; border-radius: 9px; cursor: pointer; color: var(--muted);
}
.seg-btn.on { background: #fff; color: var(--primary); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }

/* ---------- 游戏 ---------- */
.scorebar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); border-radius: 12px; padding: 12px 16px; margin-bottom: 16px;
  box-shadow: 0 2px 12px rgba(40,44,80,0.05);
}
.score-side { font-size: 13px; color: var(--muted); }
.score-mid { font-size: 14px; font-weight: 600; }

.role-tag {
  display: inline-block; font-size: 14px; font-weight: 600;
  padding: 6px 16px; border-radius: 20px; margin-bottom: 14px;
}
.role-under { background: #ffe5e6; color: var(--red); }
.role-civ { background: #e3ecff; color: var(--blue); }

.word-show {
  font-size: 42px; font-weight: 700; margin: 10px 0 20px;
  color: var(--text); letter-spacing: 2px;
}

.stage-title { font-size: 18px; font-weight: 600; margin: 4px 0 12px; }
.countdown {
  font-size: 64px; font-weight: 700; color: var(--primary);
  font-variant-numeric: tabular-nums; margin: 8px 0;
}
.countdown.small { font-size: 40px; margin: 4px 0; }
.speaker-name { font-size: 28px; font-weight: 700; margin: 8px 0; }

.player-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; justify-content: center; }
.strip-dot {
  font-size: 12px; padding: 5px 12px; border-radius: 16px;
  background: #f0f1f8; color: var(--muted);
}
.strip-dot.cur { background: var(--primary); color: #fff; font-weight: 600; }

.vote-list { list-style: none; margin: 12px 0; padding: 0; }
.vote-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 12px; border: 1.5px solid var(--border);
  margin-bottom: 10px; cursor: pointer; transition: border .12s, background .12s;
}
.vote-item.sel { border-color: var(--primary); background: #f4f2ff; }
.check {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border);
  margin-left: auto; flex-shrink: 0;
}
.vote-item.sel .check { border-color: var(--primary); background: var(--primary); }

/* ---------- 打字发言 ---------- */
.speechlog {
  margin-top: 14px;
  text-align: left;
  background: #fafbfe;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  max-height: 200px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.speechlog.vote { margin: 12px 0 4px; max-height: 150px; }
.speech-item {
  display: flex; gap: 8px;
  padding: 6px 0; border-bottom: 1px dashed var(--border);
  font-size: 14px; line-height: 1.5;
}
.speech-item:last-child { border-bottom: none; }
.speech-who { flex-shrink: 0; color: var(--primary); font-weight: 600; }
.speech-item.me .speech-who { color: var(--blue); }
.speech-text { color: var(--text); word-break: break-word; }

.speakbox { display: flex; gap: 8px; align-items: stretch; margin: 4px 0 12px; }
.speakbox-input {
  flex: 1; margin-bottom: 0; resize: none;
  line-height: 1.5; font-family: inherit; padding: 10px 12px;
}
.speakbox-send { width: 84px; flex-shrink: 0; margin-bottom: 0; }

.killed-name { font-size: 28px; font-weight: 700; margin: 8px 0 6px; }
.winner-banner {
  font-size: 26px; font-weight: 700; padding: 22px; border-radius: 14px;
  margin-bottom: 14px; color: #fff;
}
.winner-banner.under { background: var(--red); }
.winner-banner.civ { background: var(--blue); }

/* ---------- 随时查看我的词 ---------- */
.worddock {
  position: fixed;
  left: 50%; bottom: 18px; transform: translateX(-50%);
  width: min(448px, calc(100vw - 32px));
  z-index: 60;
}
.worddock-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 13px 18px;
  border: none; border-radius: 14px; cursor: pointer;
  background: rgba(31, 35, 51, 0.9); color: #fff;
  font-size: 15px; font-weight: 600;
  box-shadow: 0 6px 20px rgba(31,35,51,0.22);
}
.worddock-btn.on { background: var(--primary); }
.worddock-eye { letter-spacing: .5px; }
.worddock-hint { font-size: 12px; font-weight: 400; opacity: .75; }
.worddock-panel {
  background: var(--card);
  border-radius: 14px; padding: 16px; text-align: center;
  margin-bottom: 10px;
  box-shadow: 0 8px 28px rgba(31,35,51,0.16);
  border: 1px solid var(--border);
  animation: pop .16s ease-out;
}
.worddock-word {
  font-size: 34px; font-weight: 700; letter-spacing: 2px;
  color: var(--text); margin-top: 4px; word-break: break-all;
}
@keyframes pop {
  from { opacity: 0; transform: translateY(6px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- 轻提示 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%);
  background: rgba(31, 35, 51, 0.92); color: #fff;
  padding: 10px 20px; border-radius: 24px; font-size: 14px;
  z-index: 99; max-width: 80vw; text-align: center;
}
.fade-enter-active, .fade-leave-active { transition: opacity .2s; }
.fade-enter-from, .fade-leave-to { opacity: 0; }
