/* =========================================================
   中国象棋  —  视觉层
   纸本设色：米宣纸底 + 深胡桃木框 + 浅木棋盘
   ========================================================= */

:root{
  --paper:      #f8f4ec;
  --ink:        #221f1a;
  --ink-2:      #5c5446;
  --ink-3:      #918877;
  --line:       rgba(120,100,70,.16);
  --line-strong:rgba(120,100,70,.28);
  --red:        #a8342b;
  --red-soft:   rgba(168,52,43,.10);
  --black:      #242220;
  --gold:       #b08a55;
  --serif: "Songti SC","Noto Serif SC","Source Han Serif SC","Source Han Serif CN",STSong,SimSun,Georgia,serif;
  --sans: "PingFang SC","Hiragino Sans GB","Microsoft YaHei",system-ui,-apple-system,"Segoe UI",sans-serif;
  --shadow-card: 0 18px 40px -30px rgba(70,50,25,.55), 0 1px 2px rgba(70,50,25,.05);
}

*{ box-sizing: border-box; }

html{ -webkit-text-size-adjust: 100%; }

body{
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(70% 50% at 8% -4%, #fffdf8 0%, rgba(255,253,248,0) 62%),
    radial-gradient(60% 46% at 102% 104%, #eee4d2 0%, rgba(238,228,210,0) 64%),
    linear-gradient(178deg, #fbf8f1 0%, #f5efe3 46%, #efe7d8 100%);
  background-attachment: fixed;
}
body.locked{ overflow: hidden; }

/* 极淡的纸纹 */
body::before{
  content:"";
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    repeating-linear-gradient(92deg, rgba(150,120,80,.030) 0 1px, transparent 1px 6px),
    repeating-linear-gradient(2deg, rgba(150,120,80,.020) 0 1px, transparent 1px 9px);
  mix-blend-mode: multiply;
}

.page{
  position: relative; z-index: 1;
  max-width: min(1060px, 100%);
  margin: 0 auto;
  min-height: 100vh;
  display: flex; flex-direction: column;
  padding: 0 clamp(16px, 3vw, 28px);
}

/* ---------------- 右上角齿轮 ---------------- */

.gear{
  position: fixed; top: 14px; right: 14px; z-index: 30;
  width: 42px; height: 42px; padding: 0;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.6);
  color: var(--ink-2);
  cursor: pointer;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px -10px rgba(90,70,40,.8);
  transition: color .2s, background .22s, border-color .22s, transform .3s;
}
.gear svg{ width: 20px; height: 20px; }
.gear:hover{ color: var(--red); background: #fff; border-color: rgba(168,52,43,.26); transform: rotate(45deg); }
.gear[aria-expanded="true"]{ color: var(--red); background: #fff; border-color: rgba(168,52,43,.32); }
.gear:focus-visible{ outline: 2px solid rgba(168,52,43,.45); outline-offset: 2px; }

/* ---------------- 布局：棋盘 + 右侧操作/聊天 ---------------- */

.layout{
  flex: 1 0 auto;
  display: flex; justify-content: center; align-items: center;
  padding: 52px 0 clamp(16px, 2.6vh, 30px);
}

.stage-row{
  --side: clamp(232px, 24vw, 300px);
  --gap: clamp(14px, 1.8vw, 24px);
  width: 100%;
  display: flex; align-items: stretch; justify-content: center;
  gap: var(--gap);
}

.board-col{
  --stage: min(calc(100% - var(--side) - var(--gap)), 660px, calc((100vh - 170px) * .9));
  width: var(--stage);
  flex: none;
  position: relative;          /* 步时条绝对定位，不占布局、不影响棋盘大小 */
  display: flex; flex-direction: column;
}

/* ---------------- 步时 ---------------- */

/* 浮在棋盘上沿外侧：出现/消失都不改变棋盘、侧栏的位置和尺寸 */
.clockbar{
  position: absolute;
  left: 0; right: 0; top: -30px;
  display: flex; align-items: baseline; justify-content: flex-end; gap: 4px;
  height: 24px; margin: 0 3px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
  user-select: none;
  pointer-events: none;
}
.clockbar[hidden]{ display: none; }
.clockbar.idle{ visibility: hidden; }
.clock-tag{ font-size: 11px; letter-spacing: .18em; }
.clock-num{
  font-family: var(--serif); font-size: 17px; font-weight: 600;
  letter-spacing: .04em; color: var(--ink-2);
  transition: color .3s;
}
.clock-unit{ font-size: 11px; letter-spacing: .06em; }
/* 「不限」时把单位藏掉，用同色小字写「不限」，不抢戏 */
.clockbar.free .clock-num{ font-size: 13px; letter-spacing: .08em; color: var(--ink-3); }
.clockbar.free .clock-unit{ display: none; }
.clockbar.warn .clock-num{ color: var(--red); }
.clockbar.warn .clock-tag,
.clockbar.warn .clock-unit{ color: rgba(168,52,43,.6); }
.clockbar.warn .clock-num{ animation: clockPulse 1s ease-in-out infinite; }
@keyframes clockPulse{ 50%{ opacity: .45; } }

/* ---------------- 棋盘 ---------------- */

.frame{
  position: relative;
  width: 100%;
  padding: clamp(10px, 1.6vw, 16px);
  border-radius: 18px;
  background:
    linear-gradient(158deg, #7a5533 0%, #5f4026 34%, #4a3019 68%, #3d2613 100%);
  box-shadow:
    0 34px 60px -34px rgba(52,34,16,.72),
    0 8px 18px -12px rgba(52,34,16,.55),
    inset 0 1px 0 rgba(255,235,205,.22),
    inset 0 -1px 0 rgba(0,0,0,.35);
}
/* 木框上的细金线 */
.frame::after{
  content:""; position:absolute; inset:5px; border-radius:14px;
  border: 1px solid rgba(226,196,148,.22);
  pointer-events: none;
}

.board{
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 10;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  background:
    radial-gradient(120% 86% at 18% 6%, rgba(255,255,255,.5) 0%, rgba(255,255,255,0) 58%),
    radial-gradient(100% 80% at 88% 96%, rgba(150,105,55,.20) 0%, rgba(150,105,55,0) 62%),
    repeating-linear-gradient(93deg, rgba(148,104,52,.028) 0 1px, rgba(148,104,52,0) 1px 11px),
    linear-gradient(164deg, #f1d7aa 0%, #e9c894 42%, #dfba82 74%, #d7b077 100%);
  box-shadow:
    inset 0 0 0 1px rgba(126,86,42,.32),
    inset 0 0 44px rgba(140,95,45,.16);
}
.board.disabled{ cursor: default; }

.grid{ display: block; width: 100%; height: 100%; }

.layer{ position: absolute; inset: 0; pointer-events: none; }

/* ---------------- 棋子 ---------------- */

.piece{
  position: absolute;
  width: calc(var(--u, 40px) * .85);
  height: calc(var(--u, 40px) * .85);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--serif);
  font-size: calc(var(--u, 40px) * .59);
  line-height: 1;
  font-weight: 600;
  user-select: none;
  background:
    radial-gradient(circle at 34% 26%, #fffdf6 0%, #f9efdb 42%, #edd9b5 76%, #dcbf93 100%);
  box-shadow:
    0 1px 1px rgba(70,48,22,.28),
    0 7px 14px -8px rgba(70,48,22,.65),
    inset 0 0 0 1.5px rgba(255,255,255,.8);
  transition:
    left .19s cubic-bezier(.32,.86,.32,1),
    top .19s cubic-bezier(.32,.86,.32,1),
    transform .16s ease,
    box-shadow .2s ease;
}
/* 内圈刻线 */
.piece::after{
  content:"";
  position: absolute; inset: 8%;
  border-radius: 50%;
  border: 1px solid rgba(152,112,60,.5);
}
.piece span{ position: relative; z-index: 1; transform: translateY(-1%); }
.piece.r{ color: #a8342b; text-shadow: 0 1px 0 rgba(255,255,255,.6); }
.piece.b{ color: #26231e; text-shadow: 0 1px 0 rgba(255,255,255,.6); }

.piece.sel{
  transform: translate(-50%,-50%) scale(1.06);
  box-shadow:
    0 0 0 2px rgba(168,52,43,.55),
    0 0 0 7px rgba(168,52,43,.11),
    0 10px 22px -10px rgba(80,25,15,.8),
    inset 0 0 0 1.5px rgba(255,255,255,.85);
  z-index: 3;
}
.piece.cap-anim{ animation: capFade .22s ease forwards; }
@keyframes capFade{ to{ opacity: 0; transform: translate(-50%,-50%) scale(.7); } }

/* ---------------- 标记层 ---------------- */

.mark{ position: absolute; transform: translate(-50%,-50%); border-radius: 50%; }

.mark.hint{
  width: calc(var(--u, 40px) * .24);
  height: calc(var(--u, 40px) * .24);
  background: rgba(60,44,26,.30);
  box-shadow: 0 0 0 1px rgba(255,255,255,.35);
}
.mark.hint-capture{
  width: calc(var(--u, 40px) * .94);
  height: calc(var(--u, 40px) * .94);
  border: 2px solid rgba(168,52,43,.62);
  background: transparent;
  box-shadow: 0 0 14px rgba(168,52,43,.22);
}
.mark.last-from{
  width: calc(var(--u, 40px) * .9);
  height: calc(var(--u, 40px) * .9);
  border: 1.5px dashed rgba(96,70,38,.45);
  background: rgba(255,246,225,.35);
}
.mark.last-to{
  width: calc(var(--u, 40px) * .96);
  height: calc(var(--u, 40px) * .96);
  background: rgba(255,244,214,.55);
  box-shadow: inset 0 0 0 1.5px rgba(150,105,50,.45);
}
.mark.check{
  width: calc(var(--u, 40px) * 1.06);
  height: calc(var(--u, 40px) * 1.06);
  box-shadow: 0 0 0 2px rgba(196,48,36,.85), 0 0 22px rgba(196,48,36,.55);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse{ 50%{ box-shadow: 0 0 0 3px rgba(196,48,36,.5), 0 0 30px rgba(196,48,36,.35); } }

/* ---------------- 右侧：操作 + 聊天 ---------------- */

.side{
  flex: 0 0 var(--side);
  display: flex; flex-direction: column; gap: 12px;
  min-width: 0; min-height: 0;
}

.acts{
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  flex: none;
}

.act{
  appearance: none; cursor: pointer;
  font: inherit; font-size: 12.5px; letter-spacing: .06em;
  color: var(--ink-2);
  padding: 11px 6px;
  border-radius: 11px;
  border: 1px solid var(--line-strong);
  background: rgba(255,255,255,.62);
  backdrop-filter: blur(6px);
  transition: color .2s, background .22s, border-color .22s, transform .12s;
  white-space: nowrap;
}
.act:hover{ color: var(--ink); background: #fff; border-color: rgba(120,100,70,.42); }
.act:active{ transform: translateY(1px); }
.act.on{
  color: var(--red); background: #fff;
  border-color: rgba(168,52,43,.34);
  box-shadow: inset 0 0 0 1px rgba(168,52,43,.08);
}
.act[disabled]{ opacity: .38; cursor: not-allowed; transform: none; }
.act[disabled]:hover{ background: rgba(255,255,255,.62); border-color: var(--line-strong); color: var(--ink-2); }

.chat{
  flex: 1 1 auto;
  min-height: 0;
  display: flex; flex-direction: column;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.5);
  backdrop-filter: blur(8px);
  box-shadow: 0 18px 40px -34px rgba(70,50,25,.5);
  overflow: hidden;
}

.chat-log{
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto;
  padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
  scrollbar-width: thin;
}
.chat-log::-webkit-scrollbar{ width: 5px; }
.chat-log::-webkit-scrollbar-thumb{ background: rgba(120,100,70,.2); border-radius: 3px; }
.chat-log:empty::before{
  content: "还没有消息";
  margin: auto;
  font-size: 11.5px; letter-spacing: .12em;
  color: #bdb3a1;
}

.msg{ display: flex; }
.msg.me{ justify-content: flex-end; }
.bubble{
  max-width: 84%;
  padding: 7px 11px;
  border-radius: 12px;
  font-size: 12.5px; line-height: 1.55;
  word-break: break-word; white-space: pre-wrap;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(90,70,40,.06);
}
.msg.me .bubble{
  background: linear-gradient(160deg, #b03a2d, #93291f);
  color: #fdf7ec;
  border-color: transparent;
}

.chat-form{
  flex: none;
  display: flex; gap: 6px;
  padding: 8px;
  border-top: 1px solid var(--line);
}
.chat-form input{
  flex: 1; min-width: 0;
  font: inherit; font-size: 12.5px;
  color: var(--ink);
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: rgba(255,255,255,.85);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.chat-form input::placeholder{ color: #b3a892; }
.chat-form input:focus{ border-color: rgba(168,52,43,.5); box-shadow: 0 0 0 3px var(--red-soft); background: #fff; }
.chat-form input:disabled{ background: rgba(120,100,70,.05); color: var(--ink-3); }
.send{
  appearance: none; cursor: pointer; flex: none;
  font: inherit; font-size: 12.5px; letter-spacing: .06em;
  color: #fdf7ec;
  padding: 0 14px;
  border: 0; border-radius: 9px;
  background: linear-gradient(160deg, #b03a2d, #93291f);
  transition: filter .2s;
}
.send:hover{ filter: brightness(1.06); }
.send[disabled]{ opacity: .4; cursor: not-allowed; filter: none; }

/* ---------------- 弹框 ---------------- */

.modal{
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center;
  padding: 20px;
}
.modal[hidden]{ display: none; }

.modal-mask{
  position: absolute; inset: 0;
  background: rgba(38,27,14,.40);
  backdrop-filter: blur(3px) saturate(.95);
  animation: fadeIn .2s ease;
}
@keyframes fadeIn{ from{ opacity: 0 } }

.modal-card{
  position: relative;
  width: min(100%, 396px);
  max-height: min(86vh, 720px);
  overflow-y: auto;
  padding: 20px 22px 18px;
  border-radius: 20px;
  background: linear-gradient(168deg, #fffdf8 0%, #faf4e7 58%, #f4ebdb 100%);
  border: 1px solid rgba(180,150,105,.34);
  box-shadow:
    0 40px 80px -42px rgba(28,16,4,.9),
    0 3px 8px rgba(60,40,18,.10),
    inset 0 1px 0 rgba(255,255,255,.7);
  animation: pop .26s cubic-bezier(.2,.9,.3,1);
  scrollbar-width: thin;
  outline: none;
}
.modal-card::-webkit-scrollbar{ width: 5px; }
.modal-card::-webkit-scrollbar-thumb{ background: rgba(120,100,70,.2); border-radius: 3px; }
@keyframes pop{ from{ opacity: 0; transform: translateY(12px) scale(.975); } }

.modal-head{
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 16px;
}
.modal-head h2{
  margin: 0;
  font-family: var(--serif);
  font-size: 15px; font-weight: 600;
  letter-spacing: .18em;
  color: var(--ink);
}

.modal-x{
  appearance: none; border: 0; background: transparent; cursor: pointer;
  width: 30px; height: 30px; flex: none;
  margin: -4px -6px -4px 0;
  display: grid; place-items: center;
  border-radius: 50%;
  font: inherit; font-size: 19px; line-height: 1;
  color: var(--ink-3);
  transition: .2s;
}
.modal-x:hover{ color: var(--red); background: var(--red-soft); }

/* ---------------- 设置项 ---------------- */

.pane[hidden]{ display: none; }

.field{ margin-bottom: 16px; }
.field label{
  display: block; margin-bottom: 8px;
  font-size: 11px; letter-spacing: .18em; color: var(--ink-3);
}

.seg{
  display: flex; gap: 4px; padding: 3px;
  border-radius: 11px;
  background: rgba(120,100,70,.07);
  border: 1px solid var(--line);
}
.seg button{
  flex: 1; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-size: 12.5px; color: var(--ink-2);
  padding: 8px 4px; border-radius: 9px;
  transition: .22s;
}
.seg button:hover{ color: var(--ink); }
.seg button.on{
  background: #fff; color: var(--red); font-weight: 600;
  box-shadow: 0 2px 8px -5px rgba(90,70,40,.6), inset 0 0 0 1px rgba(168,52,43,.14);
}

.mode-seg{ margin-bottom: 18px; }

.btn{
  appearance: none; cursor: pointer;
  font: inherit; font-size: 13px; letter-spacing: .06em;
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 11px;
  border: 1px solid var(--line-strong);
  background: rgba(255,255,255,.85);
  transition: .2s;
  white-space: nowrap;
}
.btn:hover{ background:#fff; border-color: rgba(120,100,70,.42); transform: translateY(-1px); }
.btn:active{ transform: translateY(0); }
.btn.primary{
  color: #fdf7ec;
  border-color: transparent;
  background: linear-gradient(160deg, #b03a2d, #93291f 62%, #85221a);
  box-shadow: 0 12px 22px -14px rgba(147,41,31,.95), inset 0 1px 0 rgba(255,255,255,.18);
}
.btn.primary:hover{ background: linear-gradient(160deg, #b94234, #9c2d22 62%, #8b241b); }
.btn.wide{ width: 100%; }
.btn[disabled]{ opacity: .45; cursor: not-allowed; transform: none; }

.ghost{
  appearance: none; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-size: 12px; letter-spacing: .1em;
  color: var(--ink-3); padding: 6px 8px; border-radius: 8px;
  transition: .2s;
}
.ghost:hover{ color: var(--red); background: var(--red-soft); }
.ghost:focus-visible, .btn:focus-visible, .act:focus-visible,
.modal-x:focus-visible, .seg button:focus-visible{
  outline: 2px solid rgba(168,52,43,.45); outline-offset: 2px;
}

.row{ display: flex; gap: 10px; flex-wrap: wrap; }
.row.center{ justify-content: center; }
.row > .btn{ flex: 1; }

.hint{ font-size: 12.5px; line-height: 1.7; color: var(--ink-3); margin: 0 0 14px; }

.join{ display: flex; gap: 8px; margin-top: 12px; }
.join input{
  flex: 1; min-width: 0;
  font: inherit; font-size: 14px; letter-spacing: .3em; text-align: center;
  color: var(--ink);
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid var(--line-strong);
  background: rgba(255,255,255,.8);
  outline: none;
  transition: .2s;
  text-transform: uppercase;
}
.join input::placeholder{ letter-spacing: .1em; color: #b3a892; font-size: 12.5px; }
.join input:focus{ border-color: rgba(168,52,43,.5); box-shadow: 0 0 0 3px var(--red-soft); background: #fff; }

.room{
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; margin-bottom: 16px;
  border-radius: 13px;
  background: linear-gradient(150deg, rgba(168,52,43,.055), rgba(168,52,43,.012));
  border: 1px solid rgba(168,52,43,.16);
}
.room-label{ font-size: 11px; letter-spacing: .16em; color: var(--ink-3); }
.room strong{
  font-family: var(--serif); font-size: 23px; letter-spacing: .3em;
  color: var(--red); font-weight: 600;
}
.room .ghost{ margin-left: auto; }

/* ---------------- 复盘条 ---------------- */

.boardbar{
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 10px;
  margin-top: 10px;
  padding: 7px 12px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: rgba(255,253,248,.82);
  box-shadow: 0 16px 34px -30px rgba(70,50,25,.8);
  backdrop-filter: blur(8px);
}
.boardbar[hidden]{ display: none; }

.bbbtn{
  appearance: none; cursor: pointer;
  font: inherit; font-size: 13px; letter-spacing: .06em;
  color: var(--ink);
  padding: 8px 16px; border-radius: 999px;
  border: 1px solid rgba(120,95,60,.34);
  background: rgba(255,255,255,.78);
  box-shadow: 0 6px 16px -12px rgba(70,50,25,.75);
  backdrop-filter: blur(6px);
  white-space: nowrap;
  transition: color .2s, background .22s, border-color .22s;
}
.bbbtn:hover{ color: var(--red); background: #fff; border-color: rgba(168,52,43,.38); }
.bbbtn[disabled]{ opacity: .3; cursor: not-allowed; }
.bbbtn[disabled]:hover{ color: var(--ink); background: rgba(255,255,255,.78); border-color: rgba(120,95,60,.34); }

#rvExit{ grid-column: 1; justify-self: start; }
.rvnav{ grid-column: 2; display: flex; align-items: center; gap: 10px; }
.bbbtn.nav{
  width: 36px; padding: 6px 0;
  font-size: 19px; font-weight: 600; line-height: 1.1; text-align: center;
}
.rvstep{
  min-width: 104px; text-align: center;
  font-size: 13px; font-weight: 600; letter-spacing: .06em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

/* 复盘：收起侧栏，棋盘放大 */
body.review .side{ display: none; }
body.review .gear{ display: none; }
body.review .clockbar{ display: none; }
body.review .layout{
  padding-top: 10px;
  padding-bottom: 12px;
}
body.review .board-col{
  --stage: min(100%, 760px, calc((100vh - 128px) * .9));
  width: var(--stage);
  max-width: none;
}

/* ---------------- 结果浮层 / 请求确认 ---------------- */

.result, .ask{
  position: absolute; inset: 0; z-index: 6;
  display: grid; place-items: center;
  border-radius: 18px;
  background: rgba(34,26,16,.42);
  backdrop-filter: blur(3px);
  animation: fadeIn .28s ease;
}
.result[hidden], .ask[hidden]{ display: none; }
.ask{ z-index: 7; }

.result-inner{
  width: min(88%, 320px);
  text-align: center;
  padding: 26px 22px 22px;
  border-radius: 18px;
  background: linear-gradient(165deg, #fffdf8, #f8f1e3);
  box-shadow: 0 30px 60px -26px rgba(30,18,6,.9), inset 0 0 0 1px rgba(180,150,105,.35);
  animation: rise .32s cubic-bezier(.2,.9,.3,1);
}
@keyframes rise{ from{ transform: translateY(10px) scale(.97); opacity: 0 } }
.result-kicker{ font-size: 10.5px; letter-spacing: .34em; color: var(--ink-3); }
.result-inner strong{
  display: block; margin: 12px 0 20px;
  font-family: var(--serif); font-size: 27px; letter-spacing: .16em;
  color: var(--red); font-weight: 600;
}

.ask-inner{
  width: min(84%, 290px);
  text-align: center;
  padding: 20px 20px 18px;
  border-radius: 16px;
  background: linear-gradient(165deg, #fffdf8, #f8f1e3);
  box-shadow: 0 24px 50px -24px rgba(30,18,6,.85), inset 0 0 0 1px rgba(180,150,105,.35);
  animation: rise .28s cubic-bezier(.2,.9,.3,1);
}
.ask-inner p{
  margin: 0 0 16px;
  font-size: 13px; letter-spacing: .04em; color: var(--ink-2);
}

/* ---------------- 提示 ---------------- */

.toast{
  position: fixed; left: 50%; bottom: 30px; z-index: 50;
  transform: translate(-50%, 16px);
  padding: 10px 18px; border-radius: 999px;
  background: rgba(34,28,20,.9);
  color: #f7efe2; font-size: 12.5px; letter-spacing: .06em;
  opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s;
  backdrop-filter: blur(6px);
  box-shadow: 0 14px 30px -16px rgba(0,0,0,.7);
}
.toast.on{ opacity: 1; transform: translate(-50%, 0); }

/* ---------------- 响应式 ---------------- */

@media (max-width: 880px){
  .layout{ align-items: flex-start; padding-top: 58px; }
  .stage-row{ flex-direction: column; align-items: center; gap: 14px; }
  .board-col{ width: 100%; max-width: 620px; }
  /* 窄屏棋盘已经顶到两侧，步时条回到正常流里，免得和右上角齿轮打架 */
  .clockbar{ position: static; margin: 0 3px 8px; }
  .side{ flex: none; width: 100%; max-width: 620px; }
  .chat{ min-height: 200px; max-height: 260px; }
}

@media (max-width: 560px){
  .room strong{ font-size: 19px; }
  .modal{ padding: 12px; }
  .modal-card{ padding: 18px 18px 16px; max-height: min(90vh, 720px); }
  .act{ font-size: 12px; padding: 10px 4px; }
  .boardbar{ padding: 6px 10px; gap: 8px; }
  .bbbtn{ padding: 7px 12px; font-size: 12.5px; }
  .bbbtn.nav{ width: 32px; font-size: 17px; }
  .rvstep{ min-width: 84px; font-size: 12.5px; }
}

@media (prefers-reduced-motion: reduce){
  *{ animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
