:root {
  --paper: #f7f1e4;
  --ink: #231c15;
  --muted: #8b7458;
  --red: #a6332a;
  --line: #e2d1b4;
  --green: #4f6b4a;
  --gold: #c99a3f;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background:
    radial-gradient(1100px 600px at 90% -10%, #fcf7ee 0%, rgba(252, 247, 238, 0) 60%),
    var(--paper);
  color: var(--ink);
  font: 14px/1.6 "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
}
.top {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px; border-bottom: 1px solid var(--line);
  background: rgba(251, 246, 236, .92); backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 5;
}
.brand { font-family: "Noto Serif SC", serif; font-size: 20px; font-weight: 700; letter-spacing: .04em; }
.brand span { font-size: 11px; letter-spacing: .2em; color: var(--muted); margin-left: 8px; font-weight: 400; }
.meta { color: var(--muted); font-size: 13px; }
.meta b { color: var(--red); }
.right { margin-left: auto; display: flex; gap: 6px; align-items: center; }
input[type="number"] { width: 64px; padding: 4px 6px; border: 1px solid var(--line); background: #fff; border-radius: 3px; }
button { cursor: pointer; font: inherit; }
.ghost { border: 1px solid var(--line); background: #fff; padding: 5px 12px; border-radius: 3px; }
.ghost:hover { border-color: var(--red); color: var(--red); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 18px 20px 60px; }
.loading { color: var(--muted); padding: 40px 0; }
.none { color: var(--muted); font-style: normal; font-size: 12.5px; }

/* ---------------- 玩家条 ---------------- */
.players { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-bottom: 16px; }
.pcard { border: 1px solid var(--line); background: #fff; padding: 10px 12px; border-radius: 6px; transition: box-shadow .2s, border-color .2s; }
.pcard.on { border-color: var(--red); box-shadow: 0 0 0 1px var(--red) inset, 0 6px 18px rgba(166, 51, 42, .12); }
.pname { font-weight: 700; font-family: "Noto Serif SC", serif; font-size: 16px; }
.pname i { font-style: normal; font-size: 11px; color: var(--muted); margin-left: 6px; }
.pstat { font-size: 13px; margin-top: 2px; display: flex; gap: 10px; }
.pstat .pop { animation: pop .5s ease; display: inline-block; }
.psmall { font-size: 12px; color: var(--muted); }
.sigs { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.sigs span { font-size: 11px; border: 1px solid var(--line); padding: 1px 6px; border-radius: 2px; }
.sigs .none { border: 0; color: var(--muted); }

/* ---------------- 布局 ---------------- */
.cols { display: grid; grid-template-columns: 1.15fr .85fr; gap: 14px; align-items: start; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }
.panel { border: 1px solid var(--line); background: #fff; padding: 14px 16px; border-radius: 6px; }
.panel h3 { margin: 0 0 10px; font-family: "Noto Serif SC", serif; font-size: 18px; }
.panel h4 { margin: 16px 0 8px; font-size: 12px; letter-spacing: .18em; color: var(--muted); font-weight: 500; }
.row { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; }
.row .pop { animation: pop .5s ease; display: inline-block; }
.fx { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.fx span { font-size: 11px; background: #f3e9d6; color: #6b563c; padding: 2px 8px; border-radius: 2px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fdf8ef; padding: 3px 8px; border-radius: 3px; font-size: 12.5px; }
.chip.sig { border-color: var(--red); color: var(--red); }

/* ---------------- 菜谱卡 ---------------- */
.hand { display: flex; gap: 10px; flex-wrap: wrap; }
.card {
  width: 150px; border: 1px solid var(--line); border-radius: 7px; background: #fffdf8;
  position: relative; overflow: hidden; animation: deal .34s cubic-bezier(.2, .8, .3, 1) both;
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-4px) rotate(-.6deg); box-shadow: 0 10px 22px rgba(35, 28, 21, .14); }
.card.playable { border-color: rgba(79, 107, 74, .55); }
.card.playable::after {
  content: ''; position: absolute; inset: 0; border: 2px solid rgba(79, 107, 74, .35);
  border-radius: 7px; pointer-events: none;
}

.card-art { position: relative; padding: 14px 10px 12px; text-align: center; min-height: 96px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.card-art::before { content: ''; position: absolute; inset: 0; background: var(--cc, #8b7458); opacity: .16; }
.card-cuisine {
  position: absolute; top: 6px; left: 6px; font-size: 10px; color: var(--cc, #8b7458);
  border: 1px solid currentColor; padding: 0 4px; border-radius: 2px; background: rgba(255, 253, 248, .7);
}
.card-emoji { font-size: 38px; line-height: 1.1; position: relative; filter: drop-shadow(0 2px 2px rgba(0,0,0,.08)); }
.card-name { position: relative; font-family: "Noto Serif SC", serif; font-size: 16px; font-weight: 700; margin-top: 4px; letter-spacing: .02em; }
.card-body { padding: 8px 10px 10px; }
.card-ings { display: flex; flex-wrap: wrap; gap: 4px; min-height: 20px; }
.ing { font-size: 11px; background: #f6efe2; padding: 1px 5px; border-radius: 3px; white-space: nowrap; }
.ing.any { background: #eef3ea; color: #4f6b4a; }
.card-foot { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); margin-top: 9px; }
.hand.small .card { width: 118px; }
.hand.small .card-emoji { font-size: 24px; }
.hand.small .card-name { font-size: 13px; }

.card.gold { box-shadow: 0 0 0 2px var(--gold), 0 6px 16px rgba(201, 154, 63, .25); }
.card.silver { box-shadow: 0 0 0 2px #b9c0c8, 0 6px 16px rgba(150, 160, 170, .2); }

/* ---------------- 早市 ---------------- */
.market { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.mcard {
  border: 1px solid var(--line); background: #fdf8ef; padding: 8px 10px 6px; border-radius: 6px;
  min-width: 84px; text-align: center; font-size: 12px; animation: deal .3s ease both;
}
.mcard small { display: block; font-size: 10.5px; color: var(--muted); }

/* ---------------- 动作 ---------------- */
.hint { margin: -4px 0 10px; font-size: 12.5px; color: var(--muted); }
.btns { display: flex; flex-direction: column; gap: 6px; max-height: 62vh; overflow: auto; padding-right: 4px; }
.btn {
  text-align: left; border: 1px solid var(--line); background: #fdf8ef; padding: 9px 11px;
  border-radius: 4px; animation: rise .26s ease both; transition: border-color .15s, transform .12s;
}
.btn:hover { border-color: var(--red); transform: translateX(2px); }
.btn:active { transform: scale(.995); }
.btn.danger { color: var(--muted); background: #faf6ee; }
.btn:disabled { opacity: .45; }

/* ---------------- 日志 ---------------- */
.log { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 10px; font-size: 12.5px; color: #4b3f31; }
.log h3 { font-family: "Noto Serif SC", serif; font-size: 14px; margin: 0 0 6px; }
.log div { padding: 1px 0; animation: fade .3s ease both; }

/* ---------------- 过场 ---------------- */
.pass { position: fixed; inset: 0; background: #231c15; display: flex; align-items: center; justify-content: center; z-index: 20; animation: fade .25s ease both; }
.pass.hidden, .street.hidden { display: none; }
.pass-box { text-align: center; color: #f7f1e4; animation: rise .35s ease both; }
.pass-kicker { font-size: 12px; letter-spacing: .3em; color: #b09a7c; }
.pass-name { font-family: "Noto Serif SC", serif; font-size: 56px; margin: 10px 0 24px; }
.primary { background: var(--red); color: #fff; border: 0; padding: 12px 26px; border-radius: 4px; font-size: 15px; transition: transform .12s, background .2s; }
.primary:hover { background: #8f2a22; transform: translateY(-1px); }
.pass-hint { margin-top: 16px; font-size: 12px; color: #8d7a62; }

/* ---------------- 上街翻牌 ---------------- */
.street { position: fixed; inset: 0; background: rgba(18, 14, 10, .975); z-index: 22; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; animation: fade .25s ease both; }
.street-date { color: #e8d8bd; font-family: "Noto Serif SC", serif; font-size: 22px; letter-spacing: .1em; }
.street-cards { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.flip { width: 170px; height: 210px; animation: flipIn .75s cubic-bezier(.2, .8, .3, 1) both; transform-style: preserve-3d; }
.flip-front {
  width: 100%; height: 100%; border-radius: 8px; padding: 16px 14px;
  background: linear-gradient(170deg, #fffdf7, #f3e7d2); border: 1px solid #d9c39b;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .45);
}
.flip-front.gold { box-shadow: 0 0 0 2px var(--gold), 0 18px 40px rgba(0, 0, 0, .45); }
.flip-front.silver { box-shadow: 0 0 0 2px #b9c0c8, 0 18px 40px rgba(0, 0, 0, .45); }
.fc-name { font-family: "Noto Serif SC", serif; font-size: 20px; font-weight: 700; }
.fc-type { font-size: 12px; color: var(--muted); }
.fc-money { font-size: 15px; color: var(--red); margin-top: 6px; }
.fc-money b { color: var(--gold); font-size: 13px; }
.fc-who { font-size: 12px; color: var(--muted); margin-top: 10px; }

/* ---------------- 终局 ---------------- */
.over table { width: 100%; border-collapse: collapse; margin: 8px 0 18px; }
.over th, .over td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); font-size: 13px; }
.over th { font-size: 11px; letter-spacing: .16em; color: var(--muted); font-weight: 500; }
.over tr.win td { background: #fbf3e0; font-weight: 700; }

/* ---------------- 动画 ---------------- */
@keyframes deal { from { opacity: 0; transform: translateY(14px) rotate(-2deg) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes flipIn { from { opacity: 0; transform: rotateY(80deg) translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(1); } 35% { transform: scale(1.35); color: var(--gold); } 100% { transform: scale(1); } }

/* 卡片入场顺序 */
.hand .card:nth-child(1) { animation-delay: 0ms; }
.hand .card:nth-child(2) { animation-delay: 60ms; }
.hand .card:nth-child(3) { animation-delay: 120ms; }
.hand .card:nth-child(4) { animation-delay: 180ms; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}
.pick { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.pick input { width: 52px; }
.bot {
  font-style: normal; font-size: 10px; letter-spacing: .1em; color: #6b7a8f;
  border: 1px solid #b9c4d2; border-radius: 2px; padding: 0 4px; margin-left: 6px; vertical-align: 2px;
}