/* ============================================================
   拾光游戏厅 · tictactoe.css
   井字棋：老棋牌室木盘 / 刻线九宫 / 朱漆 X / 米白 O
   胜线高亮 / 双方计分 / 状态与规则 / 移动端适配
   ============================================================ */

.ttt-wrap {
  --ttt-x: #b23a2b;
  --ttt-x-hi: #d4694f;
  --ttt-x-deep: #7c2218;
  --ttt-o: #efe3c6;
  --ttt-o-deep: #c4aa7b;
  --ttt-paper-x: #9d3123;
  --ttt-paper-o: #7a5a2b;
  --ttt-board-w: 540px;
  width: 100%;
}

/* ---------------- 舞台：暖灯下的木桌 ---------------- */
.ttt-stage {
  padding: clamp(14px, 2vw, 26px) clamp(12px, 2vw, 24px);
  background:
    radial-gradient(ellipse at 50% -6%, rgba(255, 219, 162, .16), transparent 58%),
    radial-gradient(ellipse at 50% 108%, rgba(0, 0, 0, .42), transparent 62%),
    repeating-linear-gradient(93deg, rgba(30, 17, 8, .24) 0 2px, rgba(255, 230, 183, .015) 2px 5px, transparent 5px 21px),
    linear-gradient(155deg, #452c1a, #291a0f 80%);
}

.ttt-stage-inner {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* 头顶那盏旧台灯的光晕 */
.ttt-lamp {
  position: absolute;
  top: -46px;
  left: 50%;
  width: min(92%, 620px);
  height: 260px;
  transform: translateX(-50%);
  pointer-events: none;
  background:
    radial-gradient(ellipse 52% 46% at 50% 0%, rgba(255, 218, 158, .22), rgba(255, 204, 130, .07) 46%, transparent 72%);
  filter: blur(2px);
}

/* ---------------- 木制棋盘外框 ---------------- */
.ttt-board-frame {
  position: relative;
  width: min(100%, var(--ttt-board-w));
  padding: clamp(11px, 1.8vw, 18px);
  border-radius: 9px;
  border: 1px solid rgba(16, 8, 2, .92);
  background:
    linear-gradient(180deg, rgba(255, 220, 160, .18), transparent 12%),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, .1) 0 1px, transparent 1px 6px),
    linear-gradient(152deg, #6d4a2b, #432a15 54%, #2a190c);
  box-shadow:
    0 30px 56px rgba(0, 0, 0, .55),
    0 6px 0 rgba(0, 0, 0, .35),
    inset 0 1px 0 rgba(255, 226, 176, .24),
    inset 0 -3px 10px rgba(0, 0, 0, .55);
}

/* 内圈压边 + 四角铜钉 */
.ttt-board-frame::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 6px;
  border: 1px solid rgba(255, 220, 160, .1);
  pointer-events: none;
  z-index: 2;
}

.ttt-board-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 9px;
  pointer-events: none;
  z-index: 2;
  background:
    radial-gradient(circle at 2.6% 2.6%, rgba(242, 212, 148, .68) 0 1.4px, rgba(70, 45, 18, .5) 1.6px 2.4px, transparent 2.8px),
    radial-gradient(circle at 97.4% 2.6%, rgba(242, 212, 148, .68) 0 1.4px, rgba(70, 45, 18, .5) 1.6px 2.4px, transparent 2.8px),
    radial-gradient(circle at 2.6% 97.4%, rgba(242, 212, 148, .58) 0 1.4px, rgba(70, 45, 18, .5) 1.6px 2.4px, transparent 2.8px),
    radial-gradient(circle at 97.4% 97.4%, rgba(242, 212, 148, .58) 0 1.4px, rgba(70, 45, 18, .5) 1.6px 2.4px, transparent 2.8px);
}

/* ---------------- 盘面：刨光的榉木 ---------------- */
.ttt-board {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 3px;
  container-type: inline-size;
  overflow: hidden;
  touch-action: manipulation;
  background:
    radial-gradient(ellipse at 22% 12%, rgba(255, 247, 217, .42), transparent 55%),
    radial-gradient(ellipse at 86% 94%, rgba(96, 52, 12, .22), transparent 64%),
    repeating-linear-gradient(0deg,
      rgba(122, 72, 24, .085) 0 1px,
      transparent 1px 4px,
      rgba(255, 238, 200, .055) 4px 5px,
      transparent 5px 14px),
    repeating-linear-gradient(91deg,
      rgba(122, 78, 30, .045) 0 1px,
      transparent 1px 27px),
    linear-gradient(137deg, #ddb072 0%, #d09a56 36%, #c28a49 68%, #ab7438 100%);
  box-shadow:
    inset 0 0 0 1px rgba(64, 34, 9, .55),
    inset 0 1px 0 rgba(255, 244, 212, .6),
    inset 0 0 46px rgba(96, 54, 14, .26);
}

/* 盘面暗角，让木纹有年份 */
.ttt-board::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  border-radius: 3px;
  box-shadow:
    inset 0 0 46px rgba(52, 27, 6, .3),
    inset 0 0 0 1px rgba(255, 240, 205, .12);
}

/* 刻线九宫格 */
.ttt-grid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

.ttt-grid-border {
  fill: none;
  stroke: rgba(72, 42, 13, .34);
  stroke-width: 1.5;
}

.ttt-grid-light {
  fill: none;
  stroke: rgba(255, 241, 208, .34);
  stroke-width: 2.6;
  transform: translate(1.3px, 1.7px);
}

.ttt-grid-dark {
  fill: none;
  stroke: rgba(61, 34, 10, .62);
  stroke-width: 3;
}

.ttt-grid-pin {
  fill: rgba(126, 88, 40, .6);
  stroke: rgba(255, 235, 190, .32);
  stroke-width: .8;
}

/* ---------------- 九格与棋子 ---------------- */
.ttt-cells {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  z-index: 3;
}

.ttt-cell {
  position: relative;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 2px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background .16s ease;
}

.ttt-board[data-phase="playing"] .ttt-cell:not(.is-filled):hover,
.ttt-board[data-phase="playing"] .ttt-cell:not(.is-filled):focus-visible {
  background: radial-gradient(circle at 50% 46%, rgba(255, 246, 214, .2), rgba(255, 240, 200, .04) 58%, transparent 72%);
}

.ttt-cell:focus-visible {
  outline: 2px solid rgba(230, 201, 130, .8);
  outline-offset: -3px;
}

.ttt-board[data-phase="finished"] .ttt-cell { cursor: default; }

/* 落子 */
.ttt-mark {
  position: absolute;
  inset: 11%;
  z-index: 2;
  pointer-events: none;
  transition: opacity .25s ease, filter .25s ease;
}

.ttt-mark .ttt-glyph { width: 100%; height: 100%; }

/* 幽灵落点：告诉你这一手会落在哪里 */
.ttt-ghost {
  position: absolute;
  inset: 11%;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  transform: scale(.94);
  transition: opacity .16s ease, transform .16s ease;
}

.ttt-ghost .ttt-glyph { width: 100%; height: 100%; }

.ttt-board[data-turn="x"] .ttt-ghost { color: #a83325; }
.ttt-board[data-turn="o"] .ttt-ghost { color: #fbf2dc; }

.ttt-board[data-phase="playing"] .ttt-cell:not(.is-filled):hover .ttt-ghost,
.ttt-board[data-phase="playing"] .ttt-cell:not(.is-filled):focus-visible .ttt-ghost {
  opacity: .28;
  transform: scale(1);
}

/* 上一手铜钉标记 */
.ttt-last-dot {
  position: absolute;
  right: 6.5%;
  top: 6.5%;
  width: 6.6%;
  height: 6.6%;
  border-radius: 50%;
  opacity: 0;
  z-index: 3;
  background: radial-gradient(circle at 35% 30%, #f4dda6, #a97f3d 72%);
  box-shadow: 0 0 0 1px rgba(58, 36, 10, .42), 0 0 5px rgba(244, 221, 166, .5);
  transition: opacity .2s ease;
}

.ttt-cell.is-last .ttt-last-dot { opacity: .95; }

/* 获胜三格 + 其余棋子压暗 */
.ttt-cell.is-win {
  background: radial-gradient(circle at 50% 48%, rgba(246, 220, 155, .3), rgba(246, 220, 155, .06) 58%, transparent 74%);
}

.ttt-board.is-finished.is-win-x .ttt-cell:not(.is-win) .ttt-mark,
.ttt-board.is-finished.is-win-o .ttt-cell:not(.is-win) .ttt-mark {
  opacity: .5;
  filter: saturate(.68) brightness(.92);
}

/* ---------------- 棋子笔触（SVG） ---------------- */
.ttt-glyph {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.ttt-paint {
  fill: none;
  stroke-width: 7.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ttt-glyph-shadow .ttt-paint {
  stroke: rgba(52, 20, 4, .3);
  stroke-width: 8.6;
  filter: blur(.5px);
}

.ttt-glyph--o .ttt-glyph-shadow .ttt-paint { stroke: rgba(48, 28, 7, .3); }

.ttt-glyph--x .ttt-sheen { stroke: rgba(255, 194, 164, .34); stroke-width: 2.2; }
.ttt-glyph--o .ttt-sheen { stroke: rgba(255, 251, 238, .62); stroke-width: 2.2; }

/* 线性棋子：幽灵 / 徽章 / 计分牌，继承 currentColor */
.ttt-glyph--line .ttt-paint { stroke: currentColor; }
.ttt-glyph--line .ttt-glyph-shadow { display: none; }

.ttt-cell.is-win .ttt-glyph {
  filter: drop-shadow(0 0 7px rgba(255, 226, 160, .5));
}

/* ---------------- 胜利记号线 ---------------- */
.ttt-win-line {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  pointer-events: none;
  overflow: visible;
}

.ttt-strike-main {
  fill: none;
  stroke: #f4dc9e;
  stroke-width: 5;
  stroke-linecap: round;
  filter: drop-shadow(0 1px 1px rgba(58, 29, 5, .55));
}

.ttt-strike-glow {
  fill: none;
  stroke: rgba(238, 205, 130, .34);
  stroke-width: 14;
  stroke-linecap: round;
  filter: blur(2.5px);
  opacity: .95;
}

.ttt-win-line.is-static .ttt-strike-main,
.ttt-win-line.is-on .ttt-strike-main { stroke-dashoffset: 0; }

/* ---------------- 双方名条与局数 ---------------- */
.ttt-table-strip {
  width: min(100%, var(--ttt-board-w));
  margin-top: 13px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border: 1px solid rgba(198, 160, 90, .26);
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .04), transparent 42%),
    linear-gradient(180deg, rgba(34, 22, 12, .76), rgba(17, 11, 6, .84));
  box-shadow:
    0 7px 16px rgba(0, 0, 0, .32),
    inset 0 1px 0 rgba(255, 226, 176, .09),
    inset 0 -1px 0 rgba(0, 0, 0, .4);
}

.ttt-player {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 3px;
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.ttt-player.is-x { justify-content: flex-start; }
.ttt-player.is-o { justify-content: flex-end; }

.ttt-player-mark {
  flex: 0 0 auto;
  width: 27px;
  height: 27px;
  opacity: .52;
  transition: opacity .2s ease, filter .2s ease;
}

.ttt-player-mark .ttt-glyph { width: 100%; height: 100%; }

.ttt-player.is-x .ttt-player-mark { color: #d4694f; }
.ttt-player.is-o .ttt-player-mark { color: #efe3c6; }

.ttt-player-meta { min-width: 0; line-height: 1.2; }
.ttt-player-meta--right { text-align: right; }

.ttt-player-meta b {
  display: block;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  color: #e8d7b4;
  white-space: nowrap;
}

.ttt-player-meta small {
  display: block;
  margin-top: 1px;
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: .12em;
  color: rgba(198, 160, 90, .42);
  white-space: nowrap;
}

.ttt-player-wins {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  color: rgba(198, 160, 90, .55);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .4);
  transition: color .2s ease;
}

.ttt-player.is-active {
  border-color: rgba(198, 160, 90, .32);
  background: rgba(198, 160, 90, .09);
  box-shadow: inset 0 0 16px rgba(230, 201, 130, .06);
}

.ttt-player.is-active .ttt-player-mark { opacity: 1; filter: drop-shadow(0 0 6px rgba(240, 214, 155, .35)); }
.ttt-player.is-active .ttt-player-wins { color: var(--brass-hi); }

.ttt-player.is-winner {
  border-color: rgba(230, 201, 130, .5);
  background: linear-gradient(180deg, rgba(230, 201, 130, .18), rgba(198, 160, 90, .07));
  box-shadow: inset 0 0 20px rgba(240, 214, 155, .1);
}

.ttt-player.is-winner .ttt-player-mark { opacity: 1; filter: drop-shadow(0 0 8px rgba(255, 228, 165, .55)); }
.ttt-player.is-winner .ttt-player-wins { color: #f6e3b4; }
.ttt-player.is-loser { opacity: .58; }

.ttt-round-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 76px;
  padding: 0 4px;
  text-align: center;
}

.ttt-round-label {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .16em;
  color: rgba(198, 160, 90, .48);
  white-space: nowrap;
}

.ttt-round-state {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .1em;
  line-height: 1.2;
  white-space: nowrap;
  transition: color .2s ease;
}

.ttt-round-state.is-x { color: #e08b78; }
.ttt-round-state.is-o { color: #f1e4c6; }
.ttt-round-state.is-draw { color: #e6c982; }

/* 桌牌 */
.ttt-plate {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 13px;
  border: 1px solid rgba(198, 160, 90, .26);
  border-radius: 3px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .05), transparent 40%),
    linear-gradient(160deg, #3b2514, #24160b);
  box-shadow:
    0 5px 13px rgba(0, 0, 0, .3),
    inset 0 1px 0 rgba(255, 226, 176, .12);
}

.ttt-plate-seal {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 2px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: #f4e3c2;
  background: linear-gradient(160deg, #b23a2b, #7c241b);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px rgba(0, 0, 0, .45);
}

.ttt-plate-text {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: .3em;
  color: #e9d8b4;
}

.ttt-plate-sub {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: .16em;
  color: rgba(198, 160, 90, .42);
  white-space: nowrap;
}

/* ============================================================
   侧栏
   ============================================================ */
.ttt-side .paper-card { padding: 13px 15px 14px; }
.ttt-side .ttt-rules-card { padding-bottom: 12px; }

.ttt-status-body { min-height: 82px; }
.ttt-score-body { min-height: 118px; }

/* ---- 对局状态 ---- */
.ttt-turn-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ttt-turn-badge {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(100, 67, 32, .3);
  background: radial-gradient(circle at 38% 30%, rgba(255, 252, 238, .7), rgba(226, 205, 166, .4));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 2px 5px rgba(105, 71, 32, .12);
}

.ttt-turn-badge .ttt-glyph { width: 23px; height: 23px; }
.ttt-turn-badge.is-x { color: var(--ttt-paper-x); }
.ttt-turn-badge.is-o { color: var(--ttt-paper-o); }

.ttt-turn-text { min-width: 0; }
.ttt-turn-text b {
  display: block;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .05em;
  color: #3f2a14;
}
.ttt-turn-text small {
  display: block;
  margin-top: 1px;
  font-size: 10.5px;
  color: rgba(80, 55, 27, .55);
}

.ttt-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

.ttt-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border: 1px solid rgba(100, 67, 32, .22);
  border-radius: 2px;
  background: rgba(255, 249, 232, .38);
  color: #5c4326;
  font-size: 10px;
  line-height: 1.5;
  white-space: nowrap;
}

.ttt-chip--quiet {
  color: rgba(80, 55, 27, .58);
  background: transparent;
  border-color: rgba(100, 67, 32, .14);
}

.ttt-mini-mark {
  position: relative;
  display: inline-block;
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
}

.ttt-mini-mark.is-x::before,
.ttt-mini-mark.is-x::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  height: 2px;
  border-radius: 1px;
  background: var(--ttt-paper-x);
}

.ttt-mini-mark.is-x::before { transform: translate(-50%, -50%) rotate(45deg); }
.ttt-mini-mark.is-x::after { transform: translate(-50%, -50%) rotate(-45deg); }

.ttt-mini-mark.is-o::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1.6px solid var(--ttt-paper-o);
  border-radius: 50%;
}

/* 落子记录 */
.ttt-move-log {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed rgba(100, 67, 32, .18);
}

.ttt-log-title {
  margin-right: 2px;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .12em;
  color: rgba(98, 67, 31, .38);
}

.ttt-log-item {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 5px;
  border-radius: 2px;
  border: 1px solid rgba(100, 67, 32, .16);
  font-size: 9.5px;
  letter-spacing: .02em;
  color: #5a4124;
  background: rgba(255, 250, 236, .36);
}

.ttt-log-item em {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 8px;
  color: rgba(80, 55, 27, .42);
}

.ttt-log-item.is-x { color: #8f2f22; border-color: rgba(178, 58, 43, .22); background: rgba(178, 58, 43, .06); }
.ttt-log-item.is-o { color: #6b4f22; border-color: rgba(122, 90, 43, .24); background: rgba(122, 90, 43, .06); }
.ttt-log-none { font-size: 10px; color: rgba(80, 55, 27, .4); }
.ttt-move-log.is-empty { justify-content: space-between; }

/* 终局结果 */
.ttt-result-band {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(100, 67, 32, .24);
  border-radius: 2px;
  background: rgba(255, 249, 232, .4);
}

.ttt-result-band.is-x {
  border-color: rgba(178, 58, 43, .32);
  background: linear-gradient(180deg, rgba(178, 58, 43, .1), rgba(178, 58, 43, .035));
}

.ttt-result-band.is-o {
  border-color: rgba(122, 90, 43, .38);
  background: linear-gradient(180deg, rgba(122, 90, 43, .12), rgba(122, 90, 43, .04));
}

.ttt-result-band.is-draw {
  border-color: rgba(74, 51, 29, .3);
  background: linear-gradient(180deg, rgba(74, 51, 29, .08), rgba(74, 51, 29, .025));
}

.ttt-result-seal {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 2px;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  color: #f6e7c6;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 2px 4px rgba(60, 36, 12, .25);
}

.ttt-result-seal.is-x { background: linear-gradient(160deg, #b23a2b, #7c241b); }
.ttt-result-seal.is-o { background: linear-gradient(160deg, #6d5230, #3c2a13); }
.ttt-result-seal.is-draw { background: linear-gradient(160deg, #e8d8b6, #c9ae80); color: #4a331d; }
.ttt-result-seal .ttt-glyph { width: 22px; height: 22px; color: #f6e7c6; }

.ttt-result-text { min-width: 0; }
.ttt-result-text b {
  display: block;
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: .08em;
  color: #3f2a14;
}
.ttt-result-text small {
  display: block;
  margin-top: 1px;
  font-size: 10.5px;
  color: rgba(80, 55, 27, .58);
}

.ttt-result-detail {
  margin-top: 8px;
  font-size: 10.5px;
  color: rgba(80, 55, 27, .55);
}

/* ---- 比分牌（深色木匣） ---- */
.ttt-score-card {
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .03), transparent 46%),
    radial-gradient(ellipse at 50% 0%, rgba(198, 160, 90, .1), transparent 62%),
    linear-gradient(150deg, #2b2119, #1a140e);
}

.ttt-score-caption {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 3px;
  font-size: 8px;
  letter-spacing: .2em;
  color: rgba(198, 160, 90, .42);
}

.ttt-score-caption em {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 7px;
  letter-spacing: .14em;
  color: rgba(198, 160, 90, .28);
}

.ttt-score-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 4px;
  padding: 2px 0 4px;
}

.ttt-score-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 7px 4px 6px;
  border: 1px solid transparent;
  border-radius: 3px;
  transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}

.ttt-score-side.is-active {
  border-color: rgba(198, 160, 90, .3);
  background: rgba(198, 160, 90, .06);
  box-shadow: inset 0 0 18px rgba(230, 201, 130, .06);
}

.ttt-score-glyph { width: 28px; height: 28px; opacity: .9; }
.ttt-score-glyph.is-x { color: #d98573; }
.ttt-score-glyph.is-o { color: #f0e3c6; }

.ttt-score-num {
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.05;
  color: var(--brass-hi);
  text-shadow: 0 2px 6px rgba(0, 0, 0, .45);
}

.ttt-score-side small {
  font-size: 9px;
  letter-spacing: .14em;
  color: rgba(239, 225, 196, .4);
}

.ttt-score-sep {
  font-family: var(--font-mono);
  font-size: 24px;
  color: rgba(198, 160, 90, .45);
  padding-top: 8px;
}

.ttt-score-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 7px;
  padding-top: 8px;
  border-top: 1px dashed rgba(198, 160, 90, .18);
  font-size: 10px;
  color: rgba(239, 225, 196, .5);
}

.ttt-score-meta b { font-weight: 700; color: var(--brass-hi); }
.ttt-score-meta b.is-x { color: #e08b78; }
.ttt-score-meta b.is-o { color: #f1e4c6; }
.ttt-score-meta b.is-draw { color: var(--brass-hi); }

.ttt-score-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 9px;
}

.ttt-score-card .btn {
  min-height: 26px;
  padding: 3px 9px;
  font-size: 10px;
  color: rgba(239, 225, 196, .7);
  border-color: rgba(198, 160, 90, .28);
  background: rgba(198, 160, 90, .08);
  box-shadow: none;
  text-shadow: none;
}

.ttt-score-card .btn:hover {
  color: var(--brass-hi);
  border-color: rgba(198, 160, 90, .5);
  background: rgba(198, 160, 90, .15);
}

.ttt-score-card .btn[disabled] { opacity: .34; }

.ttt-score-note {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .08em;
  color: rgba(198, 160, 90, .32);
  white-space: nowrap;
}

/* ---- 操作 ---- */
.ttt-actions-body { display: flex; flex-direction: column; gap: 8px; }

.ttt-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ttt-toolbar .btn { flex: 1 1 auto; justify-content: center; }
.ttt-toolbar .btn-block { flex: 1 1 100%; }

.ttt-spec {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 1px;
}

/* ---- 规则 ---- */
.ttt-rules-en {
  margin-left: auto;
  padding-right: 10px;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 400;
  letter-spacing: .12em;
  color: rgba(98, 67, 31, .35);
}

.ttt-rules-card .rule-list li { line-height: 1.65; }

/* ============================================================
   动效（尊重减弱动态设置）
   ============================================================ */
@media (prefers-reduced-motion: no-preference) {
  .ttt-board-frame {
    animation: ttt-board-in .48s cubic-bezier(.2, .8, .3, 1) both;
  }

  .ttt-cell.is-new .ttt-glyph {
    animation: ttt-stamp .34s cubic-bezier(.2, .9, .3, 1.25) both;
  }

  .ttt-cell.is-new .ttt-paint-main {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: ttt-stroke-draw .34s ease-out both;
  }

  .ttt-cell.is-invalid {
    animation: ttt-shake .42s ease;
  }

  .ttt-result-band:not(.is-static) {
    animation: ttt-rise .34s cubic-bezier(.2, .8, .3, 1) both;
  }

  .ttt-wrap.is-just-finished .ttt-cell.is-win .ttt-glyph {
    animation: ttt-win-pulse 1s ease-in-out 2;
  }

  .ttt-win-line.is-on .ttt-strike-main {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: ttt-strike-draw .5s .14s ease forwards;
  }

  .ttt-win-line.is-on .ttt-strike-glow {
    opacity: 0;
    animation: ttt-fade-in .4s .52s ease forwards;
  }
}

@keyframes ttt-board-in {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes ttt-stamp {
  0% { opacity: 0; transform: scale(1.42) rotate(-4deg); }
  62% { opacity: 1; transform: scale(.97) rotate(1deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

@keyframes ttt-stroke-draw {
  from { stroke-dashoffset: 100; }
  to { stroke-dashoffset: 0; }
}

@keyframes ttt-strike-draw {
  from { stroke-dashoffset: 100; }
  to { stroke-dashoffset: 0; }
}

@keyframes ttt-fade-in {
  from { opacity: 0; }
  to { opacity: .95; }
}

@keyframes ttt-win-pulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 6px rgba(255, 226, 160, .35)); }
  45% { transform: scale(1.045); filter: drop-shadow(0 0 14px rgba(255, 232, 170, .8)); }
}

@keyframes ttt-shake {
  0%, 100% { transform: translateX(0); }
  18% { transform: translateX(-5px); }
  36% { transform: translateX(4px); }
  54% { transform: translateX(-3px); }
  72% { transform: translateX(2px); }
}

@keyframes ttt-rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 1080px) {
  .ttt-wrap { --ttt-board-w: 500px; }
}

@media (max-width: 900px) {
  .ttt-wrap { --ttt-board-w: 520px; }
  .ttt-status-body { min-height: 0; }
  .ttt-score-body { min-height: 0; }
}

/* 全屏沉浸模式：让棋盘尽量占满屏幕高度 */
body.focus-mode .ttt-wrap {
  --ttt-board-w: min(calc(100vw - 36px), calc(100vh - 280px), 800px);
  --ttt-board-w: min(calc(100vw - 36px), calc(100dvh - 280px), 800px);
}

body.focus-mode .ttt-stage-inner {
  min-height: 100%;
  justify-content: center;
}

body.focus-mode .ttt-board-frame,
body.focus-mode .ttt-table-strip,
body.focus-mode .ttt-plate {
  width: min(100%, var(--ttt-board-w));
}

body.focus-mode .ttt-plate { display: flex; justify-content: center; }
body.focus-mode .ttt-plate .ttt-plate-sub { margin-left: 10px; }

@media (max-width: 600px) {
  body.focus-mode .ttt-board-frame { padding: 9px; }
}

@media (max-width: 600px) {
  .ttt-stage { padding: 12px 8px 14px; }
  .ttt-board-frame { padding: 8px; border-radius: 7px; }
  .ttt-board-frame::before { border-radius: 4px; }
  .ttt-board-frame::after { border-radius: 7px; }

  .ttt-table-strip { margin-top: 10px; padding: 6px 7px; gap: 4px; }
  .ttt-player { padding: 3px 4px; gap: 5px; }
  .ttt-player-mark { width: 21px; height: 21px; }
  .ttt-player-meta b { font-size: 10.5px; letter-spacing: .04em; }
  .ttt-player-meta small { display: none; }
  .ttt-player-wins { font-size: 16px; }
  .ttt-round-mid { min-width: 62px; padding: 0 2px; }
  .ttt-round-label { font-size: 7px; letter-spacing: .1em; }
  .ttt-round-state { font-size: 12px; }

  .ttt-plate { margin-top: 9px; padding: 5px 10px; gap: 7px; }
  .ttt-plate-sub { display: none; }
  .ttt-plate-seal { width: 22px; height: 22px; font-size: 12px; }
  .ttt-plate-text { font-size: 11px; letter-spacing: .22em; }

  .ttt-score-num { font-size: 25px; }
  .ttt-score-glyph { width: 24px; height: 24px; }
  .ttt-score-meta { font-size: 9.5px; gap: 4px 8px; }
  .ttt-score-actions { margin-top: 7px; }
  .ttt-status-body { min-height: 0; }
  .ttt-turn-badge { width: 38px; height: 38px; }
  .ttt-turn-badge .ttt-glyph { width: 20px; height: 20px; }
  .ttt-turn-text b { font-size: 14px; }
  .ttt-result-text b { font-size: 15px; }
  .ttt-log-item { font-size: 9px; }
}

@media (max-width: 380px) {
  .ttt-player-meta b { font-size: 10px; }
  .ttt-player-wins { font-size: 14px; }
  .ttt-player { gap: 4px; padding: 2px 3px; }
  .ttt-round-mid { min-width: 56px; }
  .ttt-round-state { font-size: 11px; }
  .ttt-chip { font-size: 9.5px; padding: 1px 5px; }
}
