/* 对局指挥席沿用首页的暖金与烟黑玻璃，只作用于右侧信息栏。 */
#gameView .game-sidebar {
  --ink: #fbf3e6;
  --ink-soft: #d7cbbb;
  --ink-faint: #a99d8b;
  --line: rgba(225, 195, 146, .16);
  --line-strong: rgba(225, 195, 146, .3);
  --gold: #e8c58e;
  --green: #e8c58e;
  --red: #e5a494;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 22px;
  border-left-color: rgba(232, 197, 142, .3);
  background:
    radial-gradient(ellipse at 100% 0, rgba(174, 127, 71, .16), transparent 48%),
    linear-gradient(160deg, rgba(39, 37, 32, .97), rgba(22, 24, 23, .97));
  box-shadow: -12px 0 40px rgba(13, 15, 13, .18), inset 1px 0 0 rgba(255, 239, 209, .035);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color-scheme: dark;
  scrollbar-color: #695c49 transparent;
}

#gameView .game-sidebar > * {
  flex-shrink: 0;
}

#gameView .game-sidebar-toggle {
  top: 22px;
  width: 28px;
  height: 42px;
  border-color: rgba(232, 197, 142, .3);
  border-radius: 9px 0 0 9px;
  color: #e8c58e;
  background: #2c2b25;
  box-shadow: -5px 2px 14px rgba(13, 15, 13, .12);
  font-size: 24px;
}

#gameView .game-sidebar-toggle:hover {
  background: #464034;
}

#gameView .game-sidebar .game-sidebar-nav {
  gap: 12px;
  margin-bottom: 24px;
}

#gameView .game-sidebar .back-button {
  min-height: 30px;
  padding: 4px 0;
  border: 0;
  border-radius: 3px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 12px;
  font-weight: 400;
}

#gameView .game-sidebar .back-button:hover {
  color: var(--gold);
  background: transparent;
}

#gameView .game-sidebar #gameRefreshButton {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 0 4px 8px;
  font-size: 12px;
}

#gameView .game-sidebar #gameRefreshButton::before {
  content: "↻";
  color: var(--gold);
  font-size: 16px;
  line-height: 1;
}

#gameView .game-sidebar .game-command-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 22px;
  color: var(--gold);
  font-size: 11px;
  letter-spacing: .18em;
}

#gameView .game-sidebar .game-command-insignia {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border: 1px solid var(--line-strong);
  border-radius: 7px 2px 7px 2px;
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1;
  letter-spacing: 0;
}

#gameView .game-sidebar .game-command-stripes {
  display: flex;
  gap: 3px;
  margin-left: auto;
  padding-right: 3px;
  transform: skew(-22deg);
}

#gameView .game-sidebar .game-command-stripes i {
  width: 3px;
  height: 17px;
  background: var(--gold);
  opacity: .75;
}

#gameView .game-sidebar .game-command-stripes i:nth-child(2) {
  opacity: .4;
}

#gameView .game-sidebar .game-command-stripes i:nth-child(3) {
  opacity: .16;
}

#gameView .game-sidebar .game-title-line {
  gap: 10px;
  margin-bottom: 9px;
}

#gameView .game-sidebar .eyebrow {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .08em;
}

#gameView .game-sidebar .game-heading h1 {
  margin: 0;
  font-size: 25px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: .015em;
}

#gameView .game-sidebar .heading-copy {
  margin: 6px 0 0;
  color: var(--ink-faint);
  font-size: 11px;
  line-height: 1.7;
}

#gameView .game-sidebar .status-badge {
  max-width: 58%;
  padding: 4px 9px;
  border: 1px solid rgba(232, 197, 142, .24);
  border-radius: 5px;
  color: var(--gold);
  background: rgba(232, 197, 142, .08);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.5;
  text-align: center;
  white-space: normal;
}

#gameView .game-sidebar .status-badge.finished {
  border-color: rgba(169, 157, 139, .25);
  color: var(--ink-soft);
  background: rgba(169, 157, 139, .08);
}

#gameView .game-sidebar .status-badge.grace {
  border-color: rgba(229, 164, 148, .35);
  color: #edb9a3;
  background: rgba(229, 164, 148, .09);
}

#gameView .game-sidebar .game-sidebar-section {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(241, 216, 174, .045), rgba(241, 216, 174, .012));
  box-shadow: inset 0 1px 0 rgba(255, 239, 209, .025);
}

#gameView .game-sidebar .game-state {
  margin-top: 22px;
  border-color: rgba(232, 197, 142, .28);
  background:
    radial-gradient(ellipse at 0 0, rgba(202, 155, 88, .12), transparent 80%),
    rgba(232, 197, 142, .025);
}

#gameView .game-sidebar .game-section-heading,
#gameView .game-sidebar .panel-heading.compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}

#gameView .game-sidebar h2 {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.6;
  letter-spacing: .035em;
}

#gameView .game-sidebar .game-section-index {
  color: var(--gold);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .1em;
  opacity: .65;
}

#gameView .game-sidebar .turn-notice {
  align-items: baseline;
  gap: 9px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.8;
}

#gameView .game-sidebar .turn-dot {
  position: relative;
  top: -1px;
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(232, 197, 142, .09);
}

#gameView .game-sidebar .turn-notice.my-turn {
  color: #f6dab0;
  font-weight: 600;
}

#gameView .game-sidebar .turn-notice.my-turn .turn-dot {
  background: #f6dab0;
  box-shadow: 0 0 0 4px rgba(232, 197, 142, .15), 0 0 12px rgba(232, 197, 142, .22);
}

#gameView .game-sidebar .deadline-box {
  gap: 8px;
  min-height: 48px;
  margin-top: 13px;
  padding: 9px 11px;
  border: 1px solid rgba(225, 195, 146, .09);
  border-radius: 7px;
  background: rgba(9, 12, 11, .2);
}

#gameView .game-sidebar .deadline-box span {
  color: var(--ink-faint);
  font-size: 11px;
  line-height: 1.6;
}

#gameView .game-sidebar .deadline-box strong {
  color: var(--gold);
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
  text-align: right;
  overflow-wrap: anywhere;
}

#gameView .game-sidebar .deadline-box.expired {
  border-color: rgba(229, 164, 148, .3);
  background: rgba(145, 67, 49, .1);
}

#gameView .game-sidebar .deadline-box.expired strong,
#gameView .game-sidebar .deadline-box.expired span {
  color: #edb19f;
}

#gameView .game-sidebar .deadline-box.grace strong,
#gameView .game-sidebar .deadline-box.grace span {
  color: var(--gold);
}

#gameView .game-sidebar .game-actions {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr));
  gap: 8px;
  margin-top: 12px;
}

#gameView .game-sidebar .button {
  min-height: 36px;
  padding: 8px 10px;
  border-color: var(--line-strong);
  border-radius: 7px;
  color: var(--ink-soft);
  background: rgba(232, 197, 142, .045);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
  white-space: normal;
  transition: background .16s ease, border-color .16s ease;
}

#gameView .game-sidebar .button:hover:not(:disabled) {
  border-color: rgba(232, 197, 142, .55);
  background: rgba(232, 197, 142, .12);
}

#gameView .game-sidebar .button-danger {
  border-color: rgba(229, 164, 148, .23);
  color: #ddb0a1;
  background: rgba(181, 107, 83, .045);
}

#gameView .game-sidebar .button-danger:hover:not(:disabled) {
  border-color: rgba(229, 164, 148, .5);
  background: rgba(181, 107, 83, .13);
}

#gameView .game-sidebar .button-primary,
#gameView .game-sidebar #acceptEndgameButton {
  border-color: #e8c58e;
  color: #30271c;
  background: linear-gradient(110deg, #dfb77e, #f0d4a6);
}

#gameView .game-sidebar .button-primary:hover:not(:disabled),
#gameView .game-sidebar #acceptEndgameButton:hover:not(:disabled) {
  border-color: #f5ddba;
  background: linear-gradient(110deg, #ebc58e, #f5ddba);
}

#gameView .game-sidebar .quiet-button,
#gameView .game-sidebar .text-button {
  color: var(--ink-faint);
  font-size: 11px;
  line-height: 1.6;
}

#gameView .game-sidebar .quiet-button:hover:not(:disabled),
#gameView .game-sidebar .text-button:hover:not(:disabled) {
  color: var(--gold);
}

#gameView .game-sidebar .private-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  color: var(--ink-faint);
  font-size: 10px;
  font-weight: 400;
}

#gameView .game-sidebar .private-lock {
  position: relative;
  width: 8px;
  height: 7px;
  margin-top: 3px;
  border: 1px solid currentColor;
  border-radius: 1px;
}

#gameView .game-sidebar .private-lock::before {
  position: absolute;
  bottom: 5px;
  left: 1px;
  width: 4px;
  height: 5px;
  border: 1px solid currentColor;
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
  content: "";
}

#gameView .game-sidebar #selectionEmpty {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 11px;
  min-height: 38px;
  padding: 0;
}

#gameView .game-sidebar #selectionEmpty .empty-symbol {
  display: grid;
  place-items: center;
  width: 30px;
  height: 34px;
  flex-shrink: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--gold);
  background: rgba(232, 197, 142, .035);
  font-family: var(--sans);
  font-size: 20px;
}

#gameView .game-sidebar .empty-selection p {
  width: 100%;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.9;
}

#gameView .game-sidebar .empty-selection p small {
  display: block;
  color: var(--ink-faint);
  font-size: 10px;
  line-height: 1.9;
}

#gameView .game-sidebar .selected-piece-head {
  margin-bottom: 11px;
}

#gameView .game-sidebar .selection-mark-status {
  border-color: var(--line);
  color: var(--ink-faint);
  background: rgba(9, 12, 11, .16);
  font-size: 11px;
}

#gameView .game-sidebar .panel-count {
  flex-shrink: 0;
  max-width: 48%;
  padding: 3px 6px;
  border-radius: 4px;
  color: var(--gold);
  background: rgba(232, 197, 142, .07);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
  text-align: right;
}

#gameView .game-sidebar .replay-control {
  gap: 6px;
  padding: 0 0 5px;
}

#gameView .game-sidebar .replay-control button {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink-soft);
  background: rgba(232, 197, 142, .035);
  font-size: 16px;
  font-weight: 400;
  transition: background .16s ease, border-color .16s ease;
}

#gameView .game-sidebar .replay-control button:hover:not(:disabled) {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(232, 197, 142, .12);
}

#gameView .game-sidebar #replayPlayButton:not(:disabled) {
  border-color: #e8c58e;
  color: #30271c;
  background: linear-gradient(110deg, #dfb77e, #f0d4a6);
}

#gameView .game-sidebar #replayPlayButton:hover:not(:disabled) {
  background: #f5ddba;
}

#gameView .game-sidebar .replay-control button:disabled {
  border-color: rgba(225, 195, 146, .1);
  color: #857b6d;
  background: rgba(232, 197, 142, .018);
  opacity: .65;
}

#gameView .game-sidebar #replayRange {
  height: 18px;
  margin: 7px 0 0;
  accent-color: var(--gold);
  cursor: pointer;
}

#gameView .game-sidebar #replayRange:disabled {
  opacity: .35;
  cursor: not-allowed;
}

#gameView .game-sidebar .replay-meta {
  flex-wrap: wrap;
  gap: 4px 8px;
  min-height: 24px;
  color: var(--ink-faint);
  font-size: 10px;
  line-height: 1.7;
}

#gameView .game-sidebar .move-log {
  max-height: 200px;
  padding-right: 3px;
  scrollbar-color: #695c49 transparent;
  scrollbar-width: thin;
}

#gameView .game-sidebar .move-log .empty-selection {
  display: block;
  min-height: 0;
  margin-top: 5px;
  padding: 12px 0 0 13px;
  border: 0;
  border-left: 1px solid var(--line-strong);
  border-radius: 0;
}

#gameView .game-sidebar .move-log .empty-selection p {
  color: var(--ink-faint);
  line-height: 1.9;
}

#gameView .game-sidebar .replay-v2-controls {
  gap: 10px;
  margin-bottom: 13px;
  padding: 10px;
  border-color: var(--line);
  border-radius: 7px;
  background: rgba(9, 12, 11, .18);
}

#gameView .game-sidebar .replay-seat-toggle,
#gameView .game-sidebar #replayViewerSeat,
#gameView .game-sidebar #replayFlipButton {
  border-color: var(--line);
  border-radius: 5px;
  color: var(--ink-soft);
  background: rgba(9, 12, 11, .2);
}

#gameView .game-sidebar .replay-seat-toggle.selected,
#gameView .game-sidebar #replayFlipButton[aria-pressed="true"] {
  border-color: rgba(232, 197, 142, .65);
  color: var(--gold);
  background: rgba(232, 197, 142, .1);
}

#gameView .game-sidebar .replay-seat-toggle:not(.selected) {
  border-color: rgba(225, 195, 146, .12);
  color: var(--ink-faint);
  background: rgba(9, 12, 11, .24);
}

#gameView .game-sidebar .replay-seat-toggle:hover,
#gameView .game-sidebar #replayFlipButton:hover {
  border-color: rgba(232, 197, 142, .55);
}

#gameView .game-sidebar #replayViewerSeat option {
  color: var(--ink);
  background: #282822;
}

#gameView .game-sidebar .move-item,
#gameView .game-sidebar .replay-timeline-item {
  border-top-color: var(--line);
  border-radius: 0;
}

#gameView .game-sidebar .replay-timeline-item:hover,
#gameView .game-sidebar .replay-timeline-item.active {
  color: var(--gold);
}

#gameView .game-sidebar .notice-banner {
  border-color: rgba(232, 197, 142, .3);
  border-radius: 7px;
  background: rgba(232, 197, 142, .07);
}

#gameView .game-sidebar .game-sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: auto;
  padding-top: 24px;
  color: var(--gold);
  font-size: 10px;
  line-height: 1.6;
  letter-spacing: .08em;
}

#gameView .game-sidebar .game-sidebar-footer small {
  color: var(--ink-faint);
  font-size: 9px;
  letter-spacing: 0;
}

@media (max-width: 1000px) {
  #gameView .game-sidebar {
    padding: 16px;
  }

  #gameView .game-sidebar .game-sidebar-section {
    padding: 14px;
  }

  #gameView .game-sidebar .game-heading h1 {
    font-size: 23px;
  }
}

@media (max-width: 720px), (max-width: 1000px) and (max-height: 500px) and (orientation: landscape) {
  #gameView .game-sidebar {
    padding-top: calc(16px + env(safe-area-inset-top));
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    background:
      radial-gradient(ellipse at 100% 0, rgba(174, 127, 71, .16), transparent 48%),
      linear-gradient(160deg, rgba(39, 37, 32, .985), rgba(22, 24, 23, .985));
    box-shadow: -12px 0 36px rgba(9, 12, 11, .3);
  }

  /* 留在棋盘上方的独立区域，侧栏收起后仍可触摸打开。 */
  #gameView .game-sidebar-toggle {
    top: calc(4px + env(safe-area-inset-top));
    right: calc(var(--sidebar-width) + env(safe-area-inset-right));
    width: 44px;
    height: 44px;
  }

  #gameView.sidebar-collapsed .game-sidebar-toggle {
    right: calc(8px + env(safe-area-inset-right));
  }

  /* 加上页面类提高优先级，覆盖旧的紧凑按钮尺寸，棋位点击区域保持原样。 */
  #gameView.game-page button:not(.board-hit),
  #gameView.game-page select,
  #gameView .game-sidebar #gameRefreshButton,
  #gameView .game-sidebar #replayViewerSeat,
  #gameView .game-sidebar #replayFlipButton,
  #gameView .game-sidebar #replayRange {
    min-width: 44px;
    min-height: 44px;
  }
}

@media (max-height: 900px) {
  #gameView .game-sidebar .game-sidebar-nav {
    margin-bottom: 16px;
  }

  #gameView .game-sidebar .game-command-brand {
    margin-bottom: 16px;
  }

  #gameView .game-sidebar .game-sidebar-section {
    margin-top: 13px;
    padding: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #gameView .game-sidebar button {
    transition: none;
  }
}
