/* ========== 家庭聚会游戏台 · 浅色主题（首页 + 小游戏共用） ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #2b2f3a;
  --muted: #9aa0ae;
  --orange: #ff7a3c;
  --orange-soft: #fff1e8;
  --purple: #6c5ce7;
  --purple-soft: #eeebff;
  --pink: #e84393;
  --pink-soft: #fdeaf3;
  --green: #00b894;
  --green-soft: #e2f8f1;
  --yellow: #f0932b;
  --yellow-soft: #fdf3e0;
  --red: #e74c3c;
  --red-soft: #fdeae7;
  --blue: #4834d4;
  --blue-soft: #e9e7fb;
  --cyan: #00cec9;
  --cyan-soft: #e0f7f6;
  --radius: 16px;
}
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
.wrap { max-width: 520px; margin: 0 auto; padding: 28px 18px 40px; }
button { font-family: inherit; }

/* ---------- 首页头部 ---------- */
.home-head { text-align: center; margin-bottom: 22px; }
.home-head h1 { font-size: 26px; color: var(--orange); letter-spacing: 1px; }
.home-head .sub { color: var(--muted); font-size: 14px; margin-top: 6px; }
.head-btns { display: flex; gap: 10px; justify-content: center; margin-top: 14px; }
.mini-btn {
  background: var(--card); border: 1px solid #eceef3; color: var(--text);
  font-size: 13px; padding: 8px 16px; border-radius: 999px; cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.mini-btn:active { transform: scale(.96); }

/* ---------- 游戏卡片网格 ---------- */
.game-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.game-card {
  background: var(--card); border-radius: var(--radius); padding: 22px 12px 16px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  text-decoration: none; color: var(--text);
  box-shadow: 0 2px 10px rgba(30, 40, 60, .06);
  transition: transform .15s;
}
.game-card:active { transform: scale(.96); }
.g-icon {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; margin-bottom: 12px;
}
.g-icon.num { font-weight: 700; font-size: 20px; }
.ic-orange { background: var(--orange-soft); }
.ic-purple { background: var(--purple-soft); color: var(--purple); }
.ic-pink   { background: var(--pink-soft);   color: var(--pink); }
.ic-green  { background: var(--green-soft);  color: var(--green); }
.ic-yellow { background: var(--yellow-soft); color: var(--yellow); }
.ic-red    { background: var(--red-soft); }
.ic-blue   { background: var(--blue-soft);   color: var(--blue); }
.ic-cyan   { background: var(--cyan-soft);   color: #0aa8a3; }
.g-name { font-size: 16px; font-weight: 700; }
.g-desc { font-size: 12px; color: var(--muted); margin-top: 5px; }
.g-count { font-size: 12px; color: var(--orange); margin-top: 10px; }
.home-foot { text-align: center; color: #c3c8d2; font-size: 12px; margin-top: 26px; }

/* ---------- 游戏页通用 ---------- */
.topbar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
}
.topbar a.back {
  width: 34px; height: 34px; border-radius: 50%; background: var(--card);
  display: flex; align-items: center; justify-content: center;
  text-decoration: none; color: var(--text); font-size: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06); flex: none;
}
.topbar b { font-size: 17px; }
.topbar .top-hint { margin-left: auto; font-size: 12px; color: var(--muted); }
.panel {
  background: var(--card); border-radius: var(--radius); padding: 20px 16px;
  box-shadow: 0 2px 10px rgba(30, 40, 60, .06); margin-bottom: 14px;
}
.panel-title { font-size: 14px; color: var(--muted); margin-bottom: 10px; }

.pbtn {
  display: inline-block; border: none; cursor: pointer; text-align: center;
  border-radius: 12px; font-size: 15px; font-weight: 600; padding: 13px 22px;
  background: var(--orange); color: #fff; transition: transform .12s, opacity .12s;
}
.pbtn:active { transform: scale(.96); }
.pbtn:disabled { opacity: .45; cursor: not-allowed; }
.pbtn-ghost { background: #fff; color: var(--text); border: 1px solid #e6e9f0; }
.pbtn-blue { background: var(--purple); }
.pbtn-green { background: var(--green); }
.pbtn-block { display: block; width: 100%; }
.pbtn-sm { padding: 9px 16px; font-size: 13px; border-radius: 10px; }

.pinput {
  width: 100%; border: 1.5px solid #e6e9f0; border-radius: 12px;
  padding: 13px 14px; font-size: 16px; outline: none; background: #fafbfd;
  color: var(--text);
}
.pinput:focus { border-color: var(--orange); background: #fff; }
.pinput + .pinput { margin-top: 10px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid #e6e9f0; background: #fff; color: var(--text);
  border-radius: 999px; padding: 7px 14px; font-size: 13px; cursor: pointer;
}
.chip.on { border-color: var(--orange); color: var(--orange); background: var(--orange-soft); font-weight: 600; }

/* ---------- 弹层 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(20, 24, 34, .45); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal-mask[hidden] { display: none; }
.modal {
  background: #fff; border-radius: 18px; padding: 22px 18px; width: 100%;
  max-width: 360px; max-height: 76vh; overflow-y: auto;
}
.modal h3 { text-align: center; font-size: 17px; margin-bottom: 14px; }
.modal p.mtext { font-size: 14px; color: var(--text); line-height: 1.7; text-align: center; }
.modal-btns { display: flex; gap: 10px; margin-top: 18px; }
.modal-btns .pbtn { flex: 1; }

/* ---------- 记录列表 ---------- */
.records-list { max-height: 46vh; overflow-y: auto; }
.records-list .r-item {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 10px 4px; border-bottom: 1px dashed #eef0f5; font-size: 13px;
}
.records-list .r-item:last-child { border-bottom: none; }
.records-list .r-game { color: var(--orange); flex: none; }
.records-list .r-text { flex: 1; color: var(--text); }
.records-list .r-time { color: var(--muted); flex: none; font-size: 12px; }
.records-list .r-empty { text-align: center; color: var(--muted); padding: 30px 0; font-size: 13px; }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 12%; transform: translateX(-50%);
  background: rgba(30, 34, 44, .92); color: #fff; font-size: 14px;
  padding: 11px 20px; border-radius: 10px; z-index: 99; max-width: 82vw;
  text-align: center; transition: opacity .25s; opacity: 0; pointer-events: none;
}
#toast.show { opacity: 1; }

/* ---------- 计分类 ---------- */
.score-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.score-item {
  background: #fafbfd; border: 1px solid #eef0f5; border-radius: 12px;
  padding: 8px 12px; font-size: 13px; display: flex; gap: 8px; align-items: center;
}
.score-item b { color: var(--orange); }
.score-item.cur { border-color: var(--orange); background: var(--orange-soft); }
