/* 掼蛋 PWA v0.1 */
:root {
  --felt: #0f5132;
  --felt-dark: #0b3d23;
  --bg: #07281a;
  --card-bg: #fffdf7;
  --red: #d43a2f;
  --black: #26292e;
  --gold: #e9c46a;
  --text: #e8f2ec;
  --muted: #9db8ab;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: radial-gradient(ellipse at 50% 30%, var(--felt) 0%, var(--bg) 80%);
  color: var(--text);
  min-height: 100vh;
}
.hidden { display: none !important; }

/* 顶栏（家族统一件） */
.topbar { background: rgba(0,0,0,.35); position: sticky; top: 0; z-index: 50; backdrop-filter: blur(6px); }
.topbar-inner { max-width: 860px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 10px 14px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 17px; }
.topbar-tools { display: flex; align-items: center; gap: 8px; }
.version-badge { background: #1d6a45; color: #cfe8da; font-size: 12px; padding: 2px 8px; border-radius: 10px; }
.refresh-btn { background: none; border: 1px solid #3a7a58; color: #cfe8da; width: 26px; height: 26px; border-radius: 50%; cursor: pointer; font-size: 14px; }
.topbar-slot { margin-left: auto; }

.page { max-width: 860px; margin: 0 auto; padding: 14px; }

/* HUD */
.hud { display: flex; gap: 10px; align-items: stretch; margin-bottom: 10px; flex-wrap: wrap; }
.score-box { background: rgba(255,255,255,.07); border-radius: 10px; padding: 8px 14px; text-align: center; min-width: 96px; }
.score-label { font-size: 12px; color: var(--muted); }
.score-value { font-size: 22px; font-weight: 700; color: var(--gold); }
.level-badge.them { color: #f0a5a0; }
.hint { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 10px; min-height: 18px; }

/* 牌桌 */
.table {
  background: linear-gradient(180deg, #14663f, #0e4a2d);
  border: 4px solid #6b4a2b;
  border-radius: 16px;
  padding: 12px;
  min-height: 430px;
  position: relative;
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  grid-template-rows: auto 1fr auto;
  grid-template-areas: "w n e" "c c c" "me me me";
  gap: 8px;
}
.seat { background: rgba(0,0,0,.18); border-radius: 10px; padding: 8px; }
.seat-n { grid-area: n; }
.seat-w { grid-area: w; }
.seat-e { grid-area: e; }
.seat-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.seat-head.active b { color: var(--gold); }
.seat-head.active { outline: 1px solid var(--gold); border-radius: 6px; padding: 2px 6px; }
.pass-tag { color: #f0c0bc; font-size: 13px; margin: 4px 0; }
.played { display: flex; flex-wrap: wrap; gap: 3px; margin: 4px 0; }
.backs { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 4px; }
.backs i { width: 13px; height: 19px; background: linear-gradient(135deg, #1d3a8f, #101c4d); border-radius: 2px; border: 1px solid #33499e; }
.backs em { color: var(--muted); font-size: 12px; align-self: center; margin-left: 3px; }

.center-info { grid-area: c; display: flex; justify-content: center; }
.game-log {
  width: 100%; max-width: 560px; background: rgba(0,0,0,.25);
  border-radius: 8px; padding: 8px 12px; font-size: 13px; line-height: 1.7;
  max-height: 96px; overflow: hidden;
}
.game-log div:first-child { color: var(--gold); }

/* 牌 */
.card {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  width: 34px; height: 48px; background: var(--card-bg);
  border-radius: 5px; border: 1.5px solid #c9c2ae; color: var(--black);
  font-size: 14px; line-height: 1.1; user-select: none; cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.card b { font-size: 15px; }
.card i { font-style: normal; font-size: 12px; }
.card.red { color: var(--red); }
.card.level { border-color: var(--gold); box-shadow: 0 0 5px rgba(233,196,106,.8); }
.card.mini { width: 26px; height: 37px; font-size: 11px; cursor: default; }
.card.mini b { font-size: 12px; }
.card.mini i { font-size: 10px; }
.card.joker { width: 40px; font-size: 11px; }

.my-zone { grid-area: me; }
.controls { display: flex; gap: 8px; justify-content: center; margin-bottom: 8px; flex-wrap: wrap; }
.my-hand {
  display: flex; flex-wrap: wrap; gap: 4px; justify-content: center;
  background: rgba(0,0,0,.15); border-radius: 10px; padding: 10px; min-height: 74px;
}
.my-hand .card.sel { transform: translateY(-10px); border-color: var(--gold); box-shadow: 0 4px 8px rgba(0,0,0,.5); }
.empty-tip { color: var(--muted); font-size: 13px; align-self: center; }

/* 按钮 */
.btn {
  background: #1d6a45; color: #fff; border: none; border-radius: 8px;
  padding: 9px 18px; font-size: 15px; cursor: pointer;
}
.btn.primary { background: #d97706; }
.btn.small { padding: 5px 12px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* 提示条 */
.flash {
  position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%);
  background: rgba(0,0,0,.8); color: #ffd9a0; padding: 8px 18px;
  border-radius: 20px; font-size: 14px; z-index: 90;
}

/* 说明 */
.tips { margin-top: 16px; background: rgba(255,255,255,.06); border-radius: 10px; padding: 14px; }
.tips h2 { font-size: 15px; margin-bottom: 8px; color: var(--gold); }
.tips li { font-size: 13px; line-height: 1.9; color: #cfe0d6; margin-left: 18px; }

/* 弹窗 */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-box {
  background: #103826; border: 1px solid #2c6a4b; border-radius: 14px;
  padding: 24px; max-width: 340px; width: 100%; text-align: center;
}
.modal-box h3 { margin-bottom: 12px; color: var(--gold); }
.modal-box p { font-size: 14px; line-height: 1.8; color: #cfe0d6; margin-bottom: 10px; }
.modal-box .btn { display: inline-block; margin: 4px; text-decoration: none; }

/* 页脚（家族统一件） */
.footer { text-align: center; padding: 18px 0 4px; font-size: 13px; }
.footer a { color: #9fd4b8; text-decoration: none; }
.footer .dot { color: var(--muted); margin: 0 6px; }
.disclaimer { text-align: center; color: #6f8d7f; font-size: 12px; padding: 6px 0 24px; }

@media (max-width: 620px) {
  .table { grid-template-columns: 1fr 1fr; grid-template-areas: "n n" "w e" "c c" "me me"; }
  .card { width: 30px; height: 43px; }
}
