/* 家庭大富翁 v2.0 — 全局样式（中国古典美学 + 适老化大字） */
:root {
  --bg1: #f5efe3; --bg2: #fbf7ee;
  --card: #fffdf8;
  --ink: #2b2622; --ink-gray: #6b6259;
  --line: #e6dcc8;
  --red: #b03a2e; --red-deep: #8c2a20;
  --gold: #c8a15a; --gold-deep: #a37f3a;
  --ok: #2e7d4f;
  --warn: #c77c11;
  --serif: Georgia, "Times New Roman", "Songti SC", "STZhongsong", "SimSun", serif;
  --radius: 14px;
  /* 转盘与结果数字尺寸 */
  --wheel: min(48vw, 30vh, 250px);
  --num-size: min(110px, 26vw, 20vh);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body {
  font-family: var(--serif);
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg1) 0%, var(--bg2) 55%, #f2ead9 100%);
  min-height: 100vh;
  padding: 12px 12px 100px;
  max-width: 760px;
  margin: 0 auto;
  touch-action: manipulation;
}
h1 { font-size: clamp(24px, 6.4vw, 30px); letter-spacing: 4px; }
h1 .seal {
  display: inline-block; width: 0.9em; height: 0.9em; line-height: 0.9em;
  background: var(--red); color: #fbf7ee; border-radius: 5px;
  font-size: 0.62em; text-align: center; letter-spacing: 0; vertical-align: 0.12em;
  margin-right: 8px; box-shadow: inset 0 -2px 3px rgba(0,0,0,.25);
}
h2 { font-size: 20px; margin: 18px 0 10px; color: var(--red-deep); letter-spacing: 2px; }
.sub { color: var(--ink-gray); font-size: 15px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 2px 8px rgba(90, 64, 20, 0.08);
}
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { justify-content: space-between; }

.money { font-variant-numeric: tabular-nums; font-weight: 700; }
.pos { color: var(--ok); }
.neg { color: var(--red); }

button, .btn {
  font: inherit;
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  background: var(--red);
  color: #fdf6e8;
  cursor: pointer;
  font-size: 18px;
  letter-spacing: 1px;
  box-shadow: 0 2px 6px rgba(140, 42, 32, .25);
}
button:active { opacity: 0.85; transform: scale(.98); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.ghost { background: transparent; color: var(--red); border: 1.5px solid var(--red); box-shadow: none; }
button.plain { background: #efe8d8; color: var(--ink); box-shadow: none; }
button.gold { background: linear-gradient(160deg, #d9b877, var(--gold-deep)); color: #fff8ea; }
button.big { width: 100%; padding: 16px; font-size: 21px; }
button.small { padding: 6px 12px; font-size: 15px; border-radius: 9px; }
button.danger { background: #7a2118; }

input, select, textarea {
  font: inherit;
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fffdf9;
  color: var(--ink);
  font-size: 18px;
}
input:focus, select:focus { outline: 2px solid rgba(176, 58, 46, 0.3); border-color: var(--red); }
label { font-size: 16px; color: var(--ink-gray); display: block; margin: 12px 0 6px; }

.badge {
  display: inline-block; padding: 3px 12px; border-radius: 999px;
  font-size: 14px; background: #efe8d8; color: var(--ink-gray);
}
.badge.waiting { background: #f3ead2; color: #8a6a1e; }
.badge.playing { background: #e3f0e7; color: var(--ok); }
.badge.settling { background: #fdeaea; color: var(--red); }
.badge.finished { background: #e8e4dc; color: var(--ink-gray); }

table { width: 100%; border-collapse: collapse; font-size: 16px; }
th, td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--ink-gray); font-weight: 500; font-size: 14px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.banner-warn {
  background: #fdf3dd; color: #8a5a0e; border: 1.5px solid #ecd7a4;
  border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; font-size: 17px;
}
.banner-gold {
  background: linear-gradient(90deg, #fdf6e3, #fbf0d2);
  color: #7a5a14; border: 1.5px solid var(--gold);
  border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; font-size: 17px;
}

/* ───── 转盘区（转盘左 · 显示结果右，与手绘稿一致） ───── */
.wheel-area {
  display: flex; align-items: center; justify-content: center; gap: clamp(10px, 4vw, 26px);
  padding: 6px 0 2px;
}
.result { text-align: center; min-width: 30vw; }
.result .label {
  font-size: 15px; letter-spacing: 6px; text-indent: 6px; color: var(--ink-gray); margin-bottom: 2px;
}
.result .label::before, .result .label::after { content: "—"; color: var(--gold); margin: 0 4px; }
#resultNum {
  font-size: var(--num-size);
  line-height: 1.02;
  font-weight: 700; color: var(--red);
  text-shadow:
    2px 0 0 #fff, -2px 0 0 #fff, 0 2px 0 #fff, 0 -2px 0 #fff,
    2px 2px 0 #fff, -2px 2px 0 #fff, 2px -2px 0 #fff, -2px -2px 0 #fff,
    0 8px 18px rgba(140,42,32,.28);
}
#resultNum.idle { color: #c9beac; text-shadow: none; }
#resultNum.pop { animation: pop .55s cubic-bezier(.18,1.5,.36,1) both; }
@keyframes pop {
  0% { transform: scale(.15) rotate(-18deg); opacity: 0; }
  62% { transform: scale(1.14) rotate(3deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); }
}
#wheelWrap { position: relative; width: var(--wheel); height: var(--wheel); flex-shrink: 0; }
#rotor { position: absolute; inset: 0; will-change: transform; }
#rotor canvas { display: block; width: 100%; height: 100%; }
#pointer {
  position: absolute; top: -9px; left: 50%; transform: translateX(-50%);
  z-index: 5; pointer-events: none;
  filter: drop-shadow(0 3px 4px rgba(60,20,10,.4));
}
#pointer .tri {
  width: 0; height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 24px solid var(--red);
}
#pointer .rivet {
  position: absolute; top: -8px; left: 50%; transform: translateX(-50%);
  width: 12px; height: 12px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f0dcab, var(--gold-deep));
  border: 1px solid #8a6a2e;
}
#centerBtn {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%,-50%);
  width: 37%; aspect-ratio: 1/1; border-radius: 50%;
  border: none; cursor: pointer; z-index: 4;
  font-family: inherit; font-weight: 700;
  font-size: clamp(15px, calc(var(--wheel) * 0.085), 22px);
  letter-spacing: 2px; text-indent: 2px; color: #fdf6e8;
  background: radial-gradient(circle at 34% 28%, #d4644f 0%, var(--red) 52%, var(--red-deep) 100%);
  box-shadow: 0 6px 16px rgba(90,30,20,.45), inset 0 3px 6px rgba(255,220,180,.45), inset 0 -6px 10px rgba(80,15,8,.5);
  text-shadow: 0 2px 3px rgba(80,15,8,.5);
  padding: 0;
}
#centerBtn:active { transform: translate(-50%,-50%) scale(.95); }

/* ───── 圆桌（3D 立体椭圆桌 · N 等分扇区，扇区色由 JS 注入） ───── */
.round-table {
  position: relative;
  width: min(94vw, 52vh, 460px);
  aspect-ratio: 10 / 7;           /* 椭圆透视：俯视立体感 */
  margin: 10px auto 18px;
  border-radius: 50%;
  background: #f4ead2;            /* JS 覆盖为「高光 + N 等分扇区」渐变 */
  border: 3px solid var(--gold);
  box-shadow:
    inset 0 10px 22px rgba(255,255,255,.6),
    inset 0 -14px 28px rgba(140,95,30,.30),
    inset 0 0 60px rgba(200,161,90,.18),
    0 16px 26px rgba(90,64,20,.25);
}
/* 桌体厚度（立体感的侧沿） */
.round-table::after {
  content: "";
  position: absolute;
  left: -3px; right: -3px;
  bottom: -10px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(180deg, #cf9f56 0%, #a37f3a 55%, #7c5e24 100%);
  box-shadow: 0 5px 12px rgba(60,40,10,.35);
  z-index: -1;
}
.round-table .table-center {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  text-align: center; color: var(--gold-deep);
  font-size: clamp(15px, 4vw, 20px); letter-spacing: 4px; opacity: .85;
  text-shadow: 0 1px 0 rgba(255,255,255,.7);
}
.seat {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%,-50%);
  width: 128px;
  text-align: center;
  background: var(--card);
  border: 2px solid var(--gold);
  border-radius: 12px;
  padding: 6px 4px 7px;
  box-shadow: 0 4px 12px rgba(90,64,20,.22);
  z-index: 2;
}
.seat .seat-no {
  display: inline-block; background: var(--red); color: #fbf7ee;
  font-size: 13px; border-radius: 6px; padding: 1px 8px; margin-bottom: 2px;
}
.seat .seat-name { font-size: 17px; font-weight: 700; line-height: 1.25; word-break: break-all; }
.seat .seat-cash { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.seat .seat-cash.neg { color: var(--red); }
.seat.me { border-color: var(--red); box-shadow: 0 0 0 2px rgba(176,58,46,.25), 0 3px 10px rgba(90,64,20,.15); }
.seat.host-mark::after { content: "👨‍👩‍👧"; }
.seat .crown { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); font-size: 18px; }

/* ───── 交易公告栏 ───── */
.announce h2 { margin: 8px 0 8px; }
.tx-item {
  display: flex; align-items: baseline; gap: 8px;
  padding: 9px 6px; border-bottom: 1px dashed rgba(163,127,58,.35);
  font-size: 17px;
}
.tx-item:last-child { border-bottom: none; }
.tx-item .tx-amt { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tx-item .tx-time { color: #a89a86; font-size: 13px; white-space: nowrap; }
.tx-void { text-decoration: line-through; opacity: 0.55; }
.tag-undo { font-size: 12px; background: #f3e8e6; color: var(--red); border-radius: 4px; padding: 1px 6px; }
.tx-void-btn { font-size: 13px; padding: 2px 8px; border-radius: 6px; background: #efe8d8; color: var(--ink-gray); box-shadow: none; }

/* ───── 底部操作栏（4 大按钮，适老） ───── */
.bottom-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--card); border-top: 2px solid var(--gold);
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  display: flex; gap: 8px; justify-content: center;
  z-index: 30;
  max-width: 760px; margin: 0 auto;
}
.bottom-bar button { flex: 1; max-width: 170px; padding: 15px 4px; font-size: 19px; }

/* ───── 弹窗 / toast ───── */
.overlay {
  position: fixed; inset: 0; background: rgba(30, 20, 10, 0.5);
  display: flex; align-items: center; justify-content: center; z-index: 50;
  padding: 20px;
}
.modal {
  background: var(--card); border-radius: var(--radius);
  width: 100%; max-width: 440px; max-height: 86vh; overflow-y: auto;
  padding: 20px;
  border: 1.5px solid var(--gold);
}
.modal h3 { margin-bottom: 12px; font-size: 20px; letter-spacing: 2px; }
.modal .actions { display: flex; gap: 10px; margin-top: 18px; }
.modal .actions button { flex: 1; }

#toast {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  background: rgba(43, 38, 32, 0.92); color: #fff;
  padding: 12px 20px; border-radius: 12px; font-size: 16px;
  z-index: 99; max-width: 86vw; text-align: center;
  opacity: 0; transition: opacity 0.25s; pointer-events: none;
}
#toast.show { opacity: 1; }
#toast.err { background: rgba(140, 45, 35, 0.95); }

/* ───── 二维码 / 等待页 ───── */
#qr-canvas { display: block; margin: 10px auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.join-url { word-break: break-all; font-size: 14px; background: #faf7f1; padding: 8px 10px; border-radius: 8px; }
.wait-player {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 6px; border-bottom: 1px dashed rgba(163,127,58,.35); font-size: 18px;
}
.wait-player:last-child { border-bottom: none; }
.seat-chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px; border-radius: 50%;
  background: var(--red); color: #fbf7ee; font-weight: 700; font-size: 16px;
}
.count-chip { margin-left: auto; color: var(--ink-gray); font-size: 15px; white-space: nowrap; }

/* ───── 结算页 ───── */
.settle-player { border: 1.5px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 12px; background: #fffdf8; }
.settle-player .head { display: flex; align-items: center; gap: 10px; }
.settle-player .cash-big { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.assess-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.assess-row input.name { flex: 1.4; }
.assess-row input.val { flex: 1; text-align: right; }
.rank-table .champion td { background: linear-gradient(90deg, #fdf6e3, #fffdf6); font-weight: 700; }
.rank-table .champion td:first-child { color: var(--gold-deep); }
.confirmed-mark { color: var(--ok); font-size: 15px; }

/* ───── 颁奖动画 ───── */
#award {
  position: fixed; inset: 0; z-index: 80;
  background: radial-gradient(circle at 50% 32%, rgba(200,161,90,.25), rgba(43,38,34,.88) 70%), rgba(43,38,34,.6);
  display: none; align-items: center; justify-content: center; flex-direction: column;
  text-align: center; padding: 20px;
}
#award.show { display: flex; }
#award .champ-label { color: #f0dcab; font-size: clamp(20px, 6vw, 28px); letter-spacing: 8px; text-indent: 8px; }
#award .champ-name {
  color: #fbf3dd; font-size: clamp(34px, 10vw, 52px); font-weight: 700; letter-spacing: 3px;
  text-shadow: 0 4px 16px rgba(0,0,0,.5); margin: 10px 0 4px;
}
#award .champ-total { color: #f0dcab; font-size: clamp(18px, 5vw, 24px); }
#award .medal { font-size: clamp(70px, 20vw, 110px); animation: medalIn .8s cubic-bezier(.18,1.4,.36,1) both; filter: drop-shadow(0 6px 18px rgba(240,220,171,.6)); }
#award .trophy { font-size: clamp(54px, 15vw, 84px); animation: medalIn .8s .15s cubic-bezier(.18,1.4,.36,1) both; }
@keyframes medalIn {
  0% { transform: scale(0) rotate(-30deg); opacity: 0; }
  70% { transform: scale(1.18) rotate(6deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}
#award .close-award { margin-top: 26px; }
.confetti {
  position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 2px;
  animation: confettiFall linear both; pointer-events: none;
}
@keyframes confettiFall {
  0% { transform: translateY(-4vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(108vh) rotate(720deg); opacity: .85; }
}

/* ───── 首页选择按钮组 ───── */
.opt-group { display: flex; gap: 8px; flex-wrap: wrap; }
.opt-group button { flex: 1; min-width: 64px; background: #efe8d8; color: var(--ink); box-shadow: none; border: 1.5px solid var(--line); }
.opt-group button.on { background: var(--red); color: #fdf6e8; border-color: var(--red-deep); }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #ccc; margin-right: 5px; }
.dot.on { background: var(--ok); }

/* ───── 手机竖屏专项适配（华为/小米，≤520px 一屏装下） ───── */
@media (max-width: 520px) {
  :root {
    --wheel: min(40vw, 21vh, 170px);
    --num-size: min(62px, 18vw, 13vh);
  }
  body { padding: 8px 8px 64px; }
  h1 { font-size: 21px; letter-spacing: 2px; }
  h1 .seal { margin-right: 5px; }
  .sub { font-size: 13px; }
  .card { padding: 10px 12px; margin-bottom: 8px; }
  h2 { font-size: 18px; margin: 12px 0 8px; }
  label { font-size: 15px; margin: 10px 0 5px; }
  input, select, textarea { font-size: 17px; padding: 11px 12px; }
  button, .btn { font-size: 17px; }
  button.big { font-size: 19px; }

  /* 转盘区：转盘缩小 + 结果数字并排 */
  .wheel-area { gap: 10px; padding: 2px 0; }
  .result { min-width: 30vw; }
  #resultNum { line-height: 1.04; }

  /* 圆桌：椭圆立体桌，矮 30% 可适当放大，座位精简但现金保持醒目 */
  .round-table { width: min(92vw, 46vh, 340px); margin: 6px auto 14px; }
  .round-table::after { bottom: -7px; height: 18px; }
  .round-table .table-center { font-size: 14px; letter-spacing: 2px; }
  .seat { width: 106px; padding: 4px 3px 5px; border-radius: 10px; }
  .seat .seat-no { font-size: 11px; padding: 1px 6px; margin-bottom: 1px; }
  .seat .seat-name { font-size: 15px; }
  .seat .seat-cash { font-size: 18px; }
  .seat .crown { font-size: 15px; top: -11px; }

  /* 公告栏紧凑 */
  .announce h2 { margin: 4px 0 6px; font-size: 17px; }
  .announce h2 button.small { padding: 4px 9px; font-size: 13px; }
  .announce #announceList { max-height: 88px; overflow-y: auto; }
  .tx-item { font-size: 15px; padding: 6px 4px; gap: 5px; }
  .tx-item .tx-time { font-size: 12px; }
  .tx-void-btn { font-size: 12px; padding: 1px 6px; }

  /* 底部操作栏：4 按钮精简 */
  .bottom-bar { padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); gap: 6px; }
  .bottom-bar button { padding: 12px 2px; font-size: 16px; letter-spacing: 0; max-width: none; }

  /* 结算页：排名表窄屏不溢出 */
  table { font-size: 14px; }
  th, td { padding: 7px 5px; }
  .rank-table th, .rank-table td { font-size: 13px; white-space: nowrap; }
  .settle-player { padding: 10px; }
  .settle-player .cash-big { font-size: 22px; }
}

@media (max-width: 380px) {
  :root { --wheel: min(32vw, 18vh, 130px); }
  .round-table { width: min(92vw, 44vh, 300px); }
  .announce #announceList { max-height: 60px; }
  .seat { width: 96px; }
  .seat .seat-cash { font-size: 16px; }
  .seat .seat-name { font-size: 14px; }
  .seat .seat-no { font-size: 10px; }
  .bottom-bar button { font-size: 15px; padding: 11px 1px; }
  h1 { font-size: 19px; }
}
