:root{
  --bg:#f6f4f1;
  --panel:#ffffff;
  --ink:#1f2229;
  --muted:#7c828d;
  --line:#e7e3dc;
  --red:#a3122a;
  --red-soft:#fbe9ec;
  --blue:#1d5fa8;
  --blue-soft:#e9f1fb;
  --gold:#c99a2e;
  --shadow:0 10px 30px rgba(31,34,41,.07);
  --radius:16px;
}

*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;padding:0}
body{
  font-family:"PingFang SC","Microsoft YaHei","Hiragino Sans GB",system-ui,-apple-system,"Segoe UI",sans-serif;
  background:
    radial-gradient(1200px 600px at 15% -10%, #fff 0%, rgba(255,255,255,0) 60%),
    var(--bg);
  color:var(--ink);
  min-height:100vh;
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3,p{margin:0}

.app{max-width:1180px;margin:0 auto;padding:20px 20px 28px}

/* ---------- 顶栏 ---------- */
.topbar{display:flex;align-items:center;justify-content:space-between;margin-bottom:18px;flex-wrap:wrap;gap:12px}
.brand{display:flex;align-items:center;gap:12px}
.logo{
  width:44px;height:44px;border-radius:13px;
  background:linear-gradient(145deg,var(--red),#7d0d20);
  color:#fff;display:grid;place-items:center;
  font-weight:800;font-size:22px;letter-spacing:.5px;
  box-shadow:0 6px 16px rgba(163,18,42,.3);
  font-family:Georgia,"Times New Roman",serif;
}
.logo.big{width:64px;height:64px;font-size:32px;border-radius:18px;margin:0 auto 14px}
.brand h1{font-size:19px;letter-spacing:.5px}
.brand p{font-size:12px;color:var(--muted);margin-top:2px}
.topstat{display:flex;align-items:center;gap:10px}
.pill{
  font-size:12.5px;color:var(--muted);
  background:var(--panel);border:1px solid var(--line);
  padding:6px 12px;border-radius:999px;
}
.ghost-btn{
  font:inherit;font-size:12.5px;color:var(--ink);
  background:var(--panel);border:1px solid var(--line);
  padding:6px 13px;border-radius:999px;cursor:pointer;
  transition:.18s;
}
.ghost-btn:hover{border-color:#d3cdc3;background:#fdfcfa}

/* ---------- 布局 ---------- */
.wrap{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:20px;align-items:start}
.board-wrap{
  background:var(--panel);border:1px solid var(--line);
  border-radius:var(--radius);padding:12px;
  box-shadow:var(--shadow);
}

/* ---------- 棋盘 ---------- */
.board{
  display:grid;
  grid-template-columns:repeat(8,1fr);
  grid-template-rows:repeat(8,1fr);
  gap:5px;
  aspect-ratio:1/1;
  width:100%;
}
.cell{
  position:relative;
  border-radius:10px;
  background:#fbfaf8;
  border:1px solid #eee9e1;
  display:flex;flex-direction:column;
  align-items:center;justify-content:flex-start;
  padding:6px 3px 3px;
  font-size:10.5px;line-height:1.15;
  text-align:center;
  overflow:hidden;
  transition:box-shadow .2s, transform .2s;
}
.cell .name{font-weight:600;color:#3a3f47;word-break:break-all;max-width:100%}
.cell .price{color:var(--muted);font-size:9.5px;margin-top:2px}
.cell .lv{
  margin-top:auto;padding-bottom:11px;display:flex;gap:2px;flex-wrap:wrap;justify-content:center;
  padding-bottom:2px;min-height:7px;
}
.cell .lv i{width:4px;height:4px;border-radius:50%;background:var(--gold);display:block}
.cell.owned-you{background:var(--red-soft);border-color:#eab9c2}
.cell.owned-ai{background:var(--blue-soft);border-color:#b8d0ec}
.cell.owned-you .name{color:#7d0d20}
.cell.owned-ai .name{color:#17456f}
.cell.here{box-shadow:0 0 0 2px rgba(163,18,42,.35) inset, 0 6px 14px rgba(31,34,41,.08);transform:translateY(-1px)}
.cell.corner{background:#f3f0ea;border-color:#e3ddd2}
.cell.kind-event{background:#fffdf3;border-color:#efe4c4}
.cell.kind-study{background:#f4fbf5;border-color:#cfe6d3}
.cell.kind-tax{background:#fdf5f4;border-color:#eed6d2}
.cell .icon{font-size:13px;line-height:1;margin-bottom:1px}

/* 棋子 */
.tokens{position:absolute;bottom:2px;left:0;right:0;display:flex;justify-content:center;gap:3px;pointer-events:none}
.token{
  width:9px;height:9px;border-radius:50%;
  border:1.5px solid #fff;
  box-shadow:0 1px 3px rgba(0,0,0,.25);
  transition:transform .18s;
}
.token.red{background:var(--red)}
.token.blue{background:var(--blue)}

/* 棋盘中心 */
.center{
  grid-column:2/8;grid-row:2/8;
  border-radius:14px;
  background:
    radial-gradient(120% 90% at 50% 0%, #fff9f2 0%, #f7f3ec 45%, #f2ece2 100%);
  border:1px dashed #e2d9c9;
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:6px;padding:14px;text-align:center;position:relative;
}
.center h2{
  font-family:Georgia,"Songti SC",serif;
  font-size:clamp(18px,2.6vw,30px);
  letter-spacing:6px;color:#4a3f33;font-weight:700;
}
.center .csub{font-size:11px;color:#9c8f7c;letter-spacing:2px}
.center .divider{width:44px;height:2px;background:var(--gold);opacity:.5;margin:4px 0}
.center .hint{font-size:11.5px;color:#8b8171;max-width:70%;line-height:1.6}

/* ---------- 侧栏 ---------- */
.side{display:flex;flex-direction:column;gap:12px}
.player-card{
  background:var(--panel);border:1px solid var(--line);border-radius:14px;
  padding:12px 14px;box-shadow:var(--shadow);transition:.25s;
}
.player-card.active{border-color:#d3c9b8;box-shadow:0 12px 26px rgba(163,18,42,.12)}
.pc-head{display:flex;align-items:center;gap:7px;font-size:13px}
.dot{width:8px;height:8px;border-radius:50%}
.dot.red{background:var(--red)}
.dot.blue{background:var(--blue)}
.pc-pts{font-size:26px;font-weight:700;letter-spacing:.5px;margin:6px 0 4px;font-variant-numeric:tabular-nums}
.pc-meta{display:flex;gap:14px;font-size:11.5px;color:var(--muted)}
.pc-meta b{color:var(--ink);font-variant-numeric:tabular-nums}

.dice-panel{
  background:var(--panel);border:1px solid var(--line);border-radius:14px;
  padding:14px;box-shadow:var(--shadow);
  display:flex;flex-direction:column;align-items:center;gap:10px;
}
.dice{
  width:62px;height:62px;border-radius:16px;
  background:linear-gradient(150deg,#fff,#f4f0e9);
  border:1px solid #e6dfd3;
  display:grid;place-items:center;
  font-size:30px;font-weight:700;color:#4a3f33;
  font-family:Georgia,serif;
  box-shadow:0 6px 14px rgba(31,34,41,.08), inset 0 -2px 0 rgba(0,0,0,.03);
}
.dice.rolling{animation:shake .28s infinite}
@keyframes shake{
  0%{transform:rotate(-6deg) scale(.98)}
  50%{transform:rotate(7deg) scale(1.03)}
  100%{transform:rotate(-5deg) scale(.99)}
}
.roll-btn{
  width:100%;font:inherit;font-size:14px;font-weight:600;letter-spacing:2px;
  color:#fff;background:linear-gradient(150deg,var(--red),#8a0f24);
  border:none;border-radius:11px;padding:11px 0;cursor:pointer;
  box-shadow:0 8px 18px rgba(163,18,42,.26);
  transition:.2s;
}
.roll-btn:hover{filter:brightness(1.06)}
.roll-btn:active{transform:translateY(1px)}
.roll-btn:disabled{background:#d9d4cb;box-shadow:none;cursor:not-allowed;color:#fff}
.turnline{font-size:11.5px;color:var(--muted)}

.log-panel{
  background:var(--panel);border:1px solid var(--line);border-radius:14px;
  padding:12px 14px;box-shadow:var(--shadow);flex:1;min-height:0;
}
.log-title{font-size:11.5px;color:var(--muted);letter-spacing:1px;margin-bottom:8px}
.log{list-style:none;margin:0;padding:0;max-height:190px;overflow-y:auto;display:flex;flex-direction:column-reverse;gap:5px}
.log li{font-size:12px;line-height:1.5;color:#43474f;padding-left:9px;position:relative}
.log li::before{content:"";position:absolute;left:0;top:7px;width:3px;height:3px;border-radius:50%;background:#cfc7b8}
.log li.bad{color:#96202f}
.log li.good{color:#2c6b45}
.log li.ai{color:#2b5d92}

/* ---------- 页脚 ---------- */
.foot{
  display:flex;justify-content:space-between;gap:10px;flex-wrap:wrap;
  margin-top:16px;font-size:11.5px;color:var(--muted);
}
.foot a{color:var(--red);text-decoration:none}
.foot a:hover{text-decoration:underline}

/* ---------- 弹窗 ---------- */
.overlay{
  position:fixed;inset:0;z-index:50;
  background:rgba(28,26,24,.42);
  backdrop-filter:blur(3px);
  display:grid;place-items:center;padding:20px;
  opacity:0;pointer-events:none;transition:opacity .22s;
}
.overlay.show{opacity:1;pointer-events:auto}
.modal-card{
  background:var(--panel);border-radius:20px;padding:26px 24px 20px;
  width:min(380px,100%);text-align:center;
  box-shadow:0 24px 60px rgba(0,0,0,.2);
  transform:translateY(8px) scale(.98);transition:transform .22s;
}
.overlay.show .modal-card{transform:none}
.modal-card.wide{width:min(520px,100%);text-align:left}
.modal-icon{font-size:34px;line-height:1;margin-bottom:10px}
.modal-card h3{font-size:17px;margin-bottom:8px}
.modal-card p{font-size:13px;color:#5a5f68;line-height:1.7}
.modal-btns{display:flex;gap:10px;margin-top:18px;justify-content:center}
.modal-btns button{
  font:inherit;font-size:13.5px;padding:10px 22px;border-radius:11px;cursor:pointer;
  border:1px solid var(--line);background:#fbfaf8;color:var(--ink);transition:.18s;
}
.modal-btns button:hover{background:#f4f1ea}
.modal-btns button.primary{background:linear-gradient(150deg,var(--red),#8a0f24);color:#fff;border:none;box-shadow:0 6px 16px rgba(163,18,42,.24)}
.modal-btns button.primary:hover{filter:brightness(1.06)}

/* ---------- 开始页 ---------- */
.start-card{
  background:var(--panel);border-radius:24px;padding:34px 30px 26px;
  width:min(460px,100%);text-align:center;
  box-shadow:0 30px 70px rgba(0,0,0,.22);
}
.start-card h2{font-family:Georgia,"Songti SC",serif;font-size:26px;letter-spacing:4px;margin-bottom:8px}
.start-card .sub{font-size:13px;color:#666c76;line-height:1.7;margin-bottom:20px}
.diff-title{font-size:12px;color:var(--muted);letter-spacing:1px;margin-bottom:9px}
.diffs{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-bottom:20px}
.diffs button{
  font:inherit;cursor:pointer;padding:10px 6px;border-radius:12px;
  border:1px solid var(--line);background:#fbfaf8;transition:.18s;
  display:flex;flex-direction:column;gap:3px;align-items:center;
}
.diffs button b{font-size:13.5px}
.diffs button span{font-size:10.5px;color:var(--muted);line-height:1.3}
.diffs button.active{border-color:var(--red);background:var(--red-soft);box-shadow:0 0 0 1px var(--red) inset}
.diffs button.active b{color:var(--red)}
.start-btn{
  width:100%;font:inherit;font-size:15px;font-weight:600;letter-spacing:2px;
  color:#fff;background:linear-gradient(150deg,var(--red),#8a0f24);
  border:none;border-radius:13px;padding:13px 0;cursor:pointer;
  box-shadow:0 12px 26px rgba(163,18,42,.28);transition:.2s;
}
.start-btn:hover{filter:brightness(1.06)}
.start-tip{font-size:11px;color:#9a9385;margin-top:14px;line-height:1.6}
.rules{margin:0;padding-left:18px;font-size:13px;color:#4d525b;line-height:1.9}
.rules b{color:var(--ink)}

/* ---------- 响应式 ---------- */
@media (max-width:900px){
  .wrap{grid-template-columns:1fr}
  .side{display:grid;grid-template-columns:1fr 1fr;gap:10px}
  .dice-panel{grid-column:1/-1}
  .log-panel{grid-column:1/-1}
  .cell{font-size:9px;padding:4px 2px 2px}
  .cell .price{display:none}
  .center h2{letter-spacing:3px}
}
@media (max-width:520px){
  .app{padding:14px 12px 20px}
  .logo{width:38px;height:38px;font-size:19px;border-radius:11px}
  .brand h1{font-size:16px}
  .board{gap:4px}
  .cell{border-radius:7px;font-size:8.5px}
  .cell .icon{font-size:11px}
  .diffs button span{display:none}
  .side{grid-template-columns:1fr 1fr}
  .pc-pts{font-size:21px}
}
