/* games.css — 大厅、棋盘、对局状态与回放；坐标保留在可玩格之外。 */
.crumb { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; color: var(--text-secondary); font-size: 14px; }
.crumb-link { display: inline-flex; align-items: center; gap: 4px; color: var(--text-secondary); text-decoration: none; }
.crumb-link:hover { color: var(--text); }
.crumb-sep { color: var(--text-tertiary); }
.crumb-title { color: var(--text); font-weight: 600; }
.room-chip:hover { background: var(--surface-muted); color: var(--text); }
.chess-wrap { --board-max: 34rem; }
.lobby-hero { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.lobby-piece { width: 46px; height: 46px; }
.lobby-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: 14px; }
.lobby-card-title { font-size: 15.5px; font-weight: 650; }
.join-row { display: flex; gap: 8px; width: 100%; }
.room-layout { display: grid; grid-template-columns: minmax(0, var(--board-max)) minmax(15rem, 1fr); gap: 26px; align-items: start; }
.player-bar { min-height: 30px; }
.player-line.turn { color: var(--text); font-weight: 600; }
.player-line .dot { width: 11px; height: 11px; border-radius: 50%; border: 1px solid var(--border-strong); flex: none; }
.player-line .dot.w { background: #fff; }
.player-line .dot.b { background: #222; }
.player-line .player-name { color: var(--text); }
.sq { position: relative; display: flex; align-items: center; justify-content: center; cursor: pointer; user-select: none; }
.sq.target:has(.pc)::after { width: 82%; height: 82%; background: transparent; box-shadow: inset 0 0 0 4px rgba(10, 132, 255, .42); border-radius: 50%; }
.sq.check::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle, rgba(217, 45, 32, .55), transparent 72%); }
.pc { width: 88%; height: 88%; pointer-events: none; position: relative; z-index: 1; }
.pc-b {
  filter: drop-shadow(1px 0 0 rgba(255, 255, 255, .5)) drop-shadow(-1px 0 0 rgba(255, 255, 255, .5))
          drop-shadow(0 1px 0 rgba(255, 255, 255, .5)) drop-shadow(0 -1px 0 rgba(255, 255, 255, .5));
}
.coord { position: absolute; font-size: 12px; font-weight: 600; opacity: 1; pointer-events: none; }
.chess-actions .btn.danger { margin-left: auto; }
.side-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.side-head { font-size: 13px; color: var(--text-tertiary); }
.code-row { display: flex; align-items: center; gap: 8px; }
.room-code:hover { color: var(--brand); }
.side-players { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.side-player { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.side-player .dot { width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--border-strong); flex: none; }
.side-player .dot.w { background: #fff; }
.side-player .dot.b { background: #222; }
.side-hint { color: var(--text-tertiary); font-size: 12px; }
.moves-table { width: 100%; max-height: 320px; overflow-y: auto; }
.moves-grid { display: grid; grid-template-columns: 2.2rem 1fr 1fr; row-gap: 2px; align-items: center; font-variant-numeric: tabular-nums; }
.mv-no { color: var(--text-tertiary); font-size: 13px; }
.mv { font-size: 14px; color: var(--text); padding: 2px 6px; border-radius: 6px; }
.mv.last { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.gomoku-grid { position: absolute; inset: 0; width: 100%; height: 100%; }
.gomoku-grid .gstar { fill: var(--text-tertiary); opacity: .55; }
.gpoint {
  position: absolute; transform: translate(-50%, -50%); width: calc(100% / var(--gomoku-size, 15) * 0.94);
  aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; border: 0;
  background: transparent; padding: 0; cursor: pointer; border-radius: 50%; z-index: 1;
}
.gpoint .stone { width: 100%; height: 100%; border-radius: 50%; position: relative; }
.stone.ghost { opacity: 0; transition: opacity .12s; }
.stone.ghost.b { background: radial-gradient(circle at 32% 28%, rgba(76,76,85,.6), rgba(22,22,26,.6) 72%); }
.stone.ghost.w { background: radial-gradient(circle at 32% 28%, rgba(255,255,255,.9), rgba(220,220,225,.9) 78%); }
.gpoint:hover .stone.ghost { opacity: .35; }
.gpoint.win .stone { box-shadow: 0 0 0 3px var(--brand); }
.gpoint.win::before { content: ''; position: absolute; inset: -22%; border-radius: 50%; background: var(--brand-soft); z-index: -1; }
.lobby-icon .lobby-piece { width: 26px; height: 26px; }
.lobby-icon img { width: 26px; height: 26px; }
.undo-banner {
  display: flex; align-items: center; gap: 10px; width: 100%; background: var(--brand-soft);
  color: var(--text); border: 1px solid var(--interactive-border); border-radius: 12px; padding: 10px 12px;
  font-size: 14px; font-weight: 550;
}
.undo-banner .spacer { flex: 1; }
.undo-banner .undo-text { color: var(--brand); }
.replay-title { color: var(--text); font-size: 14.5px; font-weight: 600; }
.replay-layout { display: grid; grid-template-columns: minmax(0, 32rem) minmax(14rem, 1fr); gap: 22px; align-items: start; }
.replay-board-col { display: flex; flex-direction: column; gap: 8px; }
.replay-board-chess { width: 100%; max-width: 32rem; }
.replay-board-gomoku { width: 100%; max-width: 32rem; }
.replay-stone { position: absolute; width: 6%; aspect-ratio: 1 / 1; height: auto; transform: translate(-50%, -50%); border-radius: 50%; z-index: 1; }
.replay-stone.replay-last { box-shadow: 0 0 0 2.5px var(--brand); }
.replay-step { color: var(--text-secondary); font-size: 13px; font-variant-numeric: tabular-nums; min-width: 4.5rem; text-align: center; }
.board-flash.center.on { animation: flash-pop 1.3s var(--ease-out); }
.board-flash.hint {
  transform: translate(-50%, -50%); padding: 4px 13px; border-radius: 999px; font-size: 13.5px;
  font-weight: 650; letter-spacing: .3px; background: var(--brand-soft); color: var(--brand);
  border: 1px solid var(--interactive-border); box-shadow: none;
}
.board-flash.hint.alert {
  background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 40%, transparent);
}
.board-flash.hint.on { animation: hint-pop 1.4s var(--ease-out); }
.gpoint.last .stone { box-shadow: 0 0 0 2.5px var(--brand); animation: stone-drop 240ms var(--ease-spring); }
.sq.last .pc { animation: piece-in 200ms var(--ease-out); }
body.game-focus .crumb { display: flex; }
body.game-focus .chess-side .side-hint { display: none; }
body.game-focus .chess-side .side-players { display: none; }
body.game-focus .chess-side .side-card { padding: 12px 14px; }
body.game-focus .room-layout { grid-template-columns: minmax(0, 1fr); justify-items: center; }
.player-line.acting .player-name { font-weight: 650; }
body.game-focus .board-col { width: min(var(--board-max), 100%); }
body.game-focus .board { margin: 0 auto; }
body.game-focus .chess-side { flex-direction: row; width: min(var(--board-max), 100%); justify-content: center; align-items: stretch; }
body.game-focus .chess-side > .card { flex: 1 1 0; min-width: 0; }
body.game-focus .chess-side .moves-table { max-height: 150px; }
.gpoint.playable { cursor: pointer; }
.gpoint.locked { cursor: default; }
.board-col.board-pending::after {
  content: ''; position: absolute; right: 6px; top: 6px; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--brand); animation: spin .7s linear infinite;
}
.player-line .face.sm {
  width: 26px; height: 26px; border-radius: 50%; flex: none; background: var(--surface-muted);
  color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; font-size: 12px;
  font-weight: 650;
}
.player-line.acting .face.sm { background: var(--brand-soft); color: var(--brand); }
.player-line .side-label { color: var(--text-tertiary); font-size: 12.5px; }
.status-bar {
  display: flex; align-items: center; gap: 8px; padding: 6px 16px; color: var(--text-secondary);
  font-size: 14.5px; min-height: 26px; align-self: center; width: auto; border-radius: 999px;
  background: var(--surface-muted); margin-top: 4px; transition: background-color 240ms ease, color 240ms ease;
}
.status-bar.done { color: var(--text); font-weight: 650; background: var(--surface-muted); }
.result-actions { display: flex; gap: 10px; justify-content: center; }
.gomoku-frame { padding: 22px 0 0 22px; position: relative; width: 100%; max-width: 32rem; }
.gomoku-cols {
  position: absolute; top: 0; left: 22px; right: 0; display: grid; grid-template-columns: repeat(15, 1fr);
  text-align: center; color: var(--text-secondary); font-size: 11px;
}
.gomoku-rows {
  position: absolute; top: 22px; bottom: 0; left: 0; width: 20px; display: grid;
  grid-template-rows: repeat(15, 1fr); align-items: center; text-align: center; color: var(--text-secondary);
  font-size: 11px;
}
.replay-winning-line { stroke: var(--brand) !important; stroke-width: .1 !important; stroke-linecap: round; }
.replay-board-gomoku .gomoku-grid { z-index: 2; pointer-events: none; }
.replay-moves button {
  border: 0; background: transparent; text-align: left; color: var(--text); cursor: pointer; font: inherit;
  min-height: 36px; padding: 4px 8px; border-radius: 6px;
}
.moves-grid button.mv {
  border: 0; background: transparent; text-align: left; color: var(--text); cursor: pointer; font: inherit;
  min-height: 36px; padding: 4px 8px; border-radius: 6px;
}
.moves-grid button.mv:hover { background: var(--brand-soft); color: var(--brand); }
.moves-grid button.mv.last { background: var(--brand-soft); color: var(--brand); }
.replay-controls .btn { min-width: 44px; min-height: 44px; }
.replay-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.replay-slider { flex: 1; min-width: 8rem; accent-color: var(--brand); min-height: 44px; width: 100%; }
.game-connection { color: var(--text-secondary); font-size: 12px; margin-left: auto; }
.game-connection.reconnecting { color: var(--danger); }
.join-row + .field-err:empty { display: none; }
html[data-theme="dark"] .moves-grid button.mv:is(:hover, .last) { color: var(--link); }
.replay-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.replay-controls select { width: auto; min-width: 80px; }
.lobby-title { font-size: 28px; font-weight: 700; margin: 0; }
.board-col { display: flex; flex-direction: column; gap: 8px; position: relative; min-width: 0; }
.chess-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.lobby-card { padding: 20px 22px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; min-width: 0; }
body.game-focus .chess-wrap { --board-max: min(42rem, calc(100dvh - 320px)); max-width: 78rem; padding-top: 14px; padding-bottom: 20px; }
.player-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-turn { margin-left: auto; color: var(--link); font-size: 12px; white-space: nowrap; }
.game-more { position: relative; }
.game-more > summary { list-style: none; cursor: pointer; }
.game-more > summary::-webkit-details-marker { display: none; }
.game-more-menu .btn { width: 100%; border-color: transparent; justify-content: flex-start; }
.game-more-menu .field-hint { padding-inline: 8px; }
.game-action-note { font-size: 12px; color: var(--text-secondary); flex-basis: 100%; }
.game-commentary { padding: 16px 0; border-top: 1px solid var(--border); font-size: 13px; }
.game-commentary strong { font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.game-commentary p { margin: 6px 0 0; }
.chess-actions .btn { min-height: 44px; }
.chess-actions { display: flex; gap: 8px; padding-top: 12px; flex-wrap: wrap; align-items: center; }
.join-row .input { min-width: 0; flex: 1; }
body.game-live .room-layout { animation: none; }
.coord.rank { top: 50%; left: -22px; transform: translateY(-50%); }
.coord.file { bottom: -22px; right: 50%; transform: translateX(50%); }
.sq.light .coord { color: var(--text-secondary); }
.sq.dark .coord { color: var(--text-secondary); }
.result-overlay {
  position: static; left: 0; right: 0; top: 50%; transform: translateY(-50%); display: block;
  justify-content: center; pointer-events: none; z-index: 5; inset: auto; padding: 16px 0; background: none;
  backdrop-filter: none;
}
.result-overlay .result-actions { justify-content: flex-start; }
.result-overlay .spark {
  position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; border-radius: 50%;
  background: var(--brand); opacity: 0; animation: spark-fly .5s ease-out forwards; display: none;
}
.lobby-icon {
  width: 56px; height: 56px; border-radius: 14px; background: var(--tone-games); display: inline-flex;
  align-items: center; justify-content: center; border: var(--bw) solid var(--line);
  box-shadow: var(--shadow-hard-sm); color: var(--on-accent);
}
.stage-gomoku .lobby-icon { background: var(--board-wood); }
.lobby-card:first-child { background: var(--tone-games-soft); }
.code-input {
  letter-spacing: 6px; text-transform: uppercase; font-variant-numeric: tabular-nums; max-width: 12rem;
  font-family: var(--font-mono); font-size: 20px; text-align: center;
}
/* Placeholder is prose; keep tracking only for the entered six-character code. */
.code-input::placeholder {
  font-family: var(--font-sans); font-size: 14px; letter-spacing: normal; text-transform: none;
  color: var(--text-tertiary); opacity: 1;
}
.lobby-grid .empty { border: var(--bw) dashed var(--line-soft); border-radius: 12px; padding: 20px; }
.board {
  width: calc(100% - 24px); max-width: var(--board-max); aspect-ratio: 1 / 1; display: grid;
  grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); border-radius: 12px;
  overflow: visible; border: 0; box-shadow: var(--shadow-hard-lg);
  transition: max-width var(--motion-layout) var(--ease-standard); margin: 0 0 24px 24px !important;
  outline: var(--bw) solid var(--line);
}
.sq.light { background: #F3EBDA; }
.sq.dark { background: #8A86C9; }
html[data-theme="dark"] .sq.light { background: #CFC8B6; }
html[data-theme="dark"] .sq.dark { background: #4F4C86; }
.sq.last::before { content: ''; position: absolute; inset: 0; background: rgba(255,211,77,.45); animation: fadein 160ms ease; }
.sq.sel::before { content: ''; position: absolute; inset: 0; background: rgba(91,99,240,.45); animation: fadein 160ms ease; }
.sq.target::after { content: ''; position: absolute; width: 26%; height: 26%; border-radius: 50%; background: rgba(24,23,31,.28); }
.gomoku-board {
  position: relative; width: 100%; max-width: var(--board-max); aspect-ratio: 1 / 1; background-color: var(--board-wood);
  border: var(--bw) solid var(--line); border-radius: 12px; box-shadow: var(--shadow-hard-lg);
}
.gomoku-grid line { stroke: rgba(24,23,31,.55); stroke-width: 1; }
.stone.b { background: #18171F; box-shadow: inset 2px 2px 0 rgba(255,255,255,.25); }
.stone.w { background: #FFFDF7; box-shadow: inset 2px 2px 0 #FFFFFF; border: var(--bw) solid #18171F; }
.player-line {
  display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-secondary);
  padding: 8px 12px; min-height: 44px; border: var(--bw) solid var(--line); border-radius: 999px;
  background: var(--surface);
}
.player-line.acting .dot {
  box-shadow: 0 0 0 3px var(--tone-sun-soft); border-color: var(--line); background: var(--tone-sun);
  animation: blink 1.8s infinite;
}
.status-bar.active { color: #FFFFFF; font-weight: 650; background: var(--brand-fill); border: var(--bw) solid var(--line); }
.board-flash {
  position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); background: var(--ink);
  color: var(--paper); padding: 11px 26px; border-radius: 14px; font-size: 19px; font-weight: 700;
  letter-spacing: 1px; opacity: 0; pointer-events: none; z-index: 6; white-space: nowrap;
  box-shadow: 3px 3px 0 var(--brand);
}
.result-card {
  pointer-events: auto; text-align: center; background: var(--tone-sun); border: var(--bw) solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow-hard); padding: 20px 24px;
  animation: result-in 320ms var(--ease-out) 120ms both; backdrop-filter: blur(2px); color: var(--on-accent);
}
.result-overlay .result-card {
  width: 100%; text-align: left; background: var(--tone-sun); border: var(--bw) solid var(--line);
  box-shadow: var(--shadow-hard); padding: 20px 24px; color: var(--on-accent); border-radius: 18px;
}
.result-title { font-size: 28px; font-weight: 850; letter-spacing: .5px; }
.result-sub { color: var(--on-accent); font-size: 13.5px; margin: 4px 0 14px; }
.room-code {
  font: inherit; font-size: 22px; font-weight: 700; letter-spacing: 4px; background: transparent;
  border: var(--bw) dashed var(--line); color: var(--text); cursor: pointer; padding: 8px 12px;
  min-height: 44px; font-family: var(--font-mono); border-radius: 12px;
}
.room-chip {
  border: var(--bw) solid var(--line); background: var(--surface); color: var(--text-secondary);
  border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 12.5px; cursor: pointer; min-height: 44px;
  font-family: var(--font-mono);
}
.game-more-menu {
  position: absolute; z-index: 10; bottom: calc(100% + 8px); left: 0; min-width: 220px;
  max-width: calc(100vw - 32px); background: var(--surface); border: var(--bw) solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow-hard); padding: 8px;
}
@keyframes flash-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.92); }
  14% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  78% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(.98); }
}
@keyframes hint-pop {
  0% { opacity: 0; transform: translate(-50%, calc(-50% + 6px)) scale(.96); }
  14% { opacity: 1; transform: translate(-50%, -50%); }
  80% { opacity: 1; transform: translate(-50%, -50%); }
  100% { opacity: 0; transform: translate(-50%, -50%); }
}
@keyframes stone-drop { from { transform: scale(1.22); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes piece-in { from { transform: scale(1.1); opacity: .7; } to { transform: none; opacity: 1; } }
@keyframes game-in { from { opacity: .55; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes result-in { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes spark-fly {
  0% { opacity: .85; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(calc(var(--dx) * 90px), calc(var(--dy) * 60px)) scale(.4); }
}
@media (min-width: 961px) {
  .wrap.chess-wrap { max-width: 66rem; }
}
@media (max-width: 960px) {
  .room-layout { grid-template-columns: 1fr; }
  .chess-side { order: 0; }
  .board { max-width: 100%; }
  .replay-layout { grid-template-columns: 1fr; }
  body.game-focus .chess-side { flex-direction: column; }
}
@media (max-width: 640px) {
  body.game-focus .chess-wrap { --board-max: 100%; padding: 16px; }
  .lobby-card { padding: 20px; }
  .player-line { gap: 6px; font-size: 13px; }
  .player-line .side-label { font-size: 12px; white-space: nowrap; }
  .chess-actions { display: flex; }
  .chess-actions > .btn { flex: 1; }
  .chess-actions > .game-more { flex: 1; }
  .game-more > summary { width: 100%; }
  .chess-actions .btn.danger { margin-left: 0; }
  .game-action-note { font-size: 12px; }
}
