:root {
  --ink: #1e1a2e;
  --muted: #6a6280;
  --panel: rgba(255, 255, 255, 0.95);
  --accent: #7c4dff;
  --accent-deep: #5e35b1;
  --ghost: #f5f5f7;
  --bottle: #2f9e44;
  --mouse: #868e96;
  --book: #1c7ed6;
  --chair: #e03131;
  --font-d: "ZCOOL KuaiLe", "Noto Sans SC", sans-serif;
  --font-b: "Noto Sans SC", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-b);
  color: var(--ink);
  font-size: 18px;
  line-height: 1.5;
  background: #1a1428;
}
.scene {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse 55% 40% at 15% 0%, rgba(124, 77, 255, 0.35), transparent 55%),
    radial-gradient(ellipse 50% 35% at 90% 20%, rgba(224, 49, 49, 0.18), transparent 50%),
    linear-gradient(165deg, #2a2040 0%, #1a1428 50%, #120e1c 100%);
}
.topbar {
  max-width: 1200px; margin: 0 auto; padding: 1rem 1.2rem 0.4rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; color: #f0eaf8;
}
.back { color: #c5a8ff; text-decoration: none; font-weight: 700; }
.brand { display: flex; gap: 0.7rem; align-items: center; flex: 1; }
.mark {
  width: 2.6rem; height: 2.6rem; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #b388ff, #7c4dff);
  color: #fff; font-family: var(--font-d); font-size: 1.3rem;
  animation: markPulse 2.4s ease-in-out infinite;
}
@keyframes markPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
.brand h1 { margin: 0; font-family: var(--font-d); font-size: 1.5rem; }
.brand p { margin: 0; font-size: 0.85rem; opacity: 0.75; }
main { max-width: 1200px; margin: 0 auto; padding: 0.5rem 1.2rem 3rem; }
.panel {
  background: var(--panel); border-radius: 18px; padding: 1.3rem;
  max-width: 480px; box-shadow: 0 12px 30px rgba(0,0,0,0.35);
}
.panel h2 { margin: 0 0 0.8rem; font-family: var(--font-d); font-size: 1.8rem; }
.field { display: grid; gap: 0.4rem; margin-top: 0.7rem; }
.field > span { font-size: 0.9rem; color: var(--muted); font-weight: 700; }
.row { display: flex; gap: 0.5rem; }
.row input {
  flex: 1; border: 1px solid #d5cce8; border-radius: 12px;
  padding: 0.7rem 0.85rem; font: inherit; background: #fff;
}
.name-list { list-style: none; margin: 0.8rem 0; padding: 0; display: grid; gap: 0.35rem; }
.name-list li {
  display: flex; justify-content: space-between;
  padding: 0.5rem 0.7rem; background: #f3eefc; border-radius: 10px; font-weight: 700;
}
.name-list button { border: 0; background: transparent; color: #c2255c; cursor: pointer; font: inherit; }
.hint { color: var(--muted); font-size: 0.9rem; }
.hint.top { margin: 0 0 0.5rem; }
.btn {
  border: 0; cursor: pointer; font: inherit; font-weight: 700;
  border-radius: 14px; padding: 0.75rem 1.3rem;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(145deg, #b388ff, #7c4dff); color: #fff; }
.btn.secondary { background: #fff; color: var(--ink); border: 1px solid #d5cce8; }
.btn.ghost { background: rgba(255,255,255,0.12); color: #f0eaf8; border: 1px solid rgba(255,255,255,0.25); }
.btn.wide { width: 100%; margin-top: 0.6rem; }
.layout { display: grid; gap: 1rem; }
@media (min-width: 900px) { .layout { grid-template-columns: 1fr 270px; } }
.status {
  display: flex; flex-wrap: wrap; gap: 0.8rem 1.2rem;
  padding: 0.85rem 1rem; border-radius: 14px;
  background: rgba(255,255,255,0.1); color: #f0eaf8; font-size: 1.1rem;
}
.status strong { color: #fff; font-size: 1.25rem; }

.table-zone {
  margin-top: 0.85rem; padding: 1rem; border-radius: 18px;
  background: rgba(255,255,255,0.08); border: 2px solid rgba(255,255,255,0.12);
}
.zone-label {
  margin: 0 0 0.7rem; text-align: center; font-weight: 700;
  color: rgba(240, 234, 248, 0.7); font-size: 0.9rem;
}
.tokens {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0.85rem;
}
.tok {
  --c: #888;
  width: 4.6rem; height: 5.2rem;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  gap: 0.25rem; padding-bottom: 0.4rem;
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(255,255,255,0.18), rgba(255,255,255,0.06));
  border: 2px solid rgba(255,255,255,0.2);
  box-shadow: 0 6px 0 rgba(0,0,0,0.25);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  color: #fff; font-weight: 800; font-size: 0.78rem;
  position: relative;
}
.tok .fig {
  width: 2.6rem; height: 2.6rem;
  margin-bottom: 0.15rem;
  filter: drop-shadow(0 3px 0 rgba(0,0,0,0.3));
}
.tok.is-answer {
  border-color: #ffe066;
  box-shadow: 0 0 0 3px rgba(255, 224, 102, 0.45), 0 8px 0 rgba(0,0,0,0.25);
  transform: translateY(-6px) scale(1.08);
  animation: tokWin 0.55s ease;
}
.tok.is-shake { animation: tokShake 0.4s ease; }
@keyframes tokWin {
  0% { transform: scale(0.9); }
  50% { transform: translateY(-10px) scale(1.12); }
  100% { transform: translateY(-6px) scale(1.08); }
}
@keyframes tokShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.tok.ghost { --c: var(--ghost); }
.tok.bottle { --c: var(--bottle); }
.tok.mouse { --c: var(--mouse); }
.tok.book { --c: var(--book); }
.tok.chair { --c: var(--chair); }
.tok.lg { width: 5.5rem; height: 6.2rem; font-size: 0.9rem; margin: 0 auto; }
.tok.lg .fig { width: 3.2rem; height: 3.2rem; }

.fig-ghost {
  background: radial-gradient(circle at 50% 35%, #fff 0 42%, transparent 43%),
    linear-gradient(180deg, #f8f9fa 30%, #dee2e6);
  border-radius: 50% 50% 12% 12%;
  position: relative;
  box-shadow: inset 0 -6px 0 rgba(0,0,0,0.08);
}
.fig-ghost::before, .fig-ghost::after {
  content: ""; position: absolute; width: 0.35rem; height: 0.35rem;
  background: #212529; border-radius: 50%; top: 38%;
}
.fig-ghost::before { left: 32%; }
.fig-ghost::after { right: 32%; }
.fig-bottle {
  background: linear-gradient(160deg, #69db7c, #2f9e44);
  clip-path: polygon(35% 0, 65% 0, 70% 18%, 78% 100%, 22% 100%, 30% 18%);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.25);
}
.fig-mouse {
  background: linear-gradient(160deg, #adb5bd, #495057);
  border-radius: 50% 50% 40% 40%;
  position: relative;
}
.fig-mouse::before {
  content: ""; position: absolute; width: 45%; height: 35%;
  right: -18%; top: 20%; border-radius: 50%;
  background: inherit;
}
.fig-book {
  background: linear-gradient(160deg, #74c0fc, #1c7ed6);
  border-radius: 4px;
  box-shadow: inset 4px 0 0 rgba(0,0,0,0.15), inset 0 0 0 2px rgba(255,255,255,0.2);
  transform: skewY(-2deg);
}
.fig-chair {
  background: linear-gradient(160deg, #ff8787, #e03131);
  clip-path: polygon(20% 0, 80% 0, 80% 35%, 95% 35%, 95% 100%, 75% 100%, 75% 55%, 25% 55%, 25% 100%, 5% 100%, 5% 35%, 20% 35%);
}

.card-stage {
  margin: 1rem auto 0; perspective: 900px;
  display: flex; justify-content: center; min-height: 12rem;
}
.flip-card {
  width: 11rem; height: 11rem; position: relative;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.flip-card.is-back { transform: rotateY(0deg); }
.flip-card.is-front { transform: rotateY(180deg); }
.flip-card .face {
  position: absolute; inset: 0; border-radius: 18px;
  backface-visibility: hidden;
  display: grid; place-items: center;
  box-shadow: 0 10px 0 rgba(0,0,0,0.3);
}
.flip-card .back {
  background: linear-gradient(145deg, #9a6dff, #5e35b1);
  color: #fff; font-family: var(--font-d); font-size: 3.5rem;
  border: 3px solid rgba(255,255,255,0.35);
}
.flip-card .front {
  background: linear-gradient(160deg, #fff8ff, #f0e6ff);
  transform: rotateY(180deg);
  border: 3px solid #7c4dff;
  display: flex; gap: 0.55rem; padding: 0.7rem; align-items: center; justify-content: center;
}
.slot {
  width: 4.4rem; height: 5.2rem; border-radius: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.2rem;
  background: #fff; box-shadow: 0 3px 0 rgba(0,0,0,0.12);
  font-size: 0.72rem; font-weight: 800; color: #333;
}
.slot .fig { width: 2.3rem; height: 2.3rem; }
.slot .paint {
  width: 100%; height: 0.35rem; border-radius: 999px; margin-top: 0.15rem;
}

.msg {
  text-align: center; font-family: var(--font-d); font-size: 1.4rem;
  color: #d0bfff; min-height: 1.6em; margin: 0.85rem 0;
}
.host-box {
  padding: 1rem; border-radius: 16px;
  background: rgba(124, 77, 255, 0.18); border: 2px dashed rgba(197, 168, 255, 0.45);
  color: #f0eaf8;
}
.host-box .kicker { margin: 0 0 0.6rem; font-size: 0.9rem; opacity: 0.8; font-weight: 700; }
.host-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.answer-peek {
  margin-top: 0.75rem; display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.45rem 0.85rem; border-radius: 12px;
  background: rgba(0,0,0,0.35); font-family: var(--font-d); font-size: 1.4rem;
  min-width: 7rem;
}
.answer-peek.is-hidden {
  background: rgba(0,0,0,0.55);
  color: #c5a8ff;
}
.answer-peek.is-hidden .tok-mini.is-cover {
  width: 1.6rem; height: 1.6rem; border-radius: 6px;
  background: repeating-linear-gradient(
    -45deg,
    #3d2a5c,
    #3d2a5c 4px,
    #2a1a40 4px,
    #2a1a40 8px
  );
  border: 1px solid rgba(197, 168, 255, 0.35);
}
.tok-mini {
  width: 1.6rem; height: 1.6rem; display: inline-block;
  vertical-align: middle;
}
.tok-mini .fig { width: 100%; height: 100%; }
.award-box { margin-top: 0.85rem; }
.award-title { margin: 0 0 0.55rem; font-weight: 700; }
.award-btns { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.award-btns .btn { padding: 0.55rem 0.95rem; font-size: 0.95rem; }

.result-flash {
  margin-top: 0.9rem; padding: 1.1rem; border-radius: 18px; text-align: center;
  background: rgba(255, 224, 102, 0.15); border: 2px solid rgba(255, 224, 102, 0.4);
  color: #ffe8a8; animation: flashIn 0.35s ease;
}
@keyframes flashIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: none; }
}
.result-flash p {
  margin: 0.55rem 0 0; font-family: var(--font-d); font-size: 1.45rem;
}

.side {
  background: var(--panel); border-radius: 18px; padding: 1rem;
  color: var(--ink); position: sticky; top: 0.6rem;
}
.side h2 { margin: 0; font-family: var(--font-d); font-size: 1.5rem; }
.scores { list-style: none; margin: 0.8rem 0; padding: 0; display: grid; gap: 0.4rem; }
.scores li {
  display: grid; grid-template-columns: 1fr auto; gap: 0.25rem;
  padding: 0.55rem 0.65rem; background: #f3eefc; border-radius: 10px;
}
.scores li.is-best .pts { color: var(--accent-deep); }
.scores .nm { font-weight: 700; display: flex; align-items: center; gap: 0.35rem; }
.scores .pts { font-weight: 700; font-size: 1.25rem; color: var(--accent-deep); }
.meeple-sm.m0 { --m: #e03131; }
.meeple-sm.m1 { --m: #1c7ed6; }
.meeple-sm.m2 { --m: #2f9e44; }
.meeple-sm.m3 { --m: #e8590c; }
.meeple-sm.m4 { --m: #7048e8; }
.meeple-sm.m5 { --m: #c2255c; }
.meeple-sm.m6 { --m: #0c8599; }
.meeple-sm.m7 { --m: #f59f00; }
.rules { border-top: 1px solid #ddd2f0; padding-top: 0.7rem; }
.rules .t { margin: 0 0 0.35rem; font-weight: 700; }
.rules ul { margin: 0; padding-left: 1.1rem; font-size: 0.88rem; color: var(--muted); line-height: 1.5; }
[hidden] { display: none !important; }
