:root {
  color-scheme: dark;
  --bg: #07110f;
  --panel: #0d1815;
  --panel-2: #12231f;
  --line: rgba(166, 244, 216, 0.18);
  --text: #edfdf7;
  --muted: #93b8aa;
  --red: #f0644f;
  --black: #d8e9e2;
  --gold: #f0c96a;
  --green: #7fd28a;
  --cyan: #6ddbd1;
  --violet: #b8a6ff;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    linear-gradient(135deg, rgba(109, 219, 209, 0.11), transparent 34%),
    linear-gradient(225deg, rgba(240, 201, 106, 0.1), transparent 32%),
    var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

button, textarea, input { font: inherit; }
button { cursor: pointer; }
h1, h2, p { margin: 0; }
h1 { font-size: 1.25rem; }
h2 { font-size: 1rem; }

.game-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 72px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
}

.topbar,
.panel,
.board-panel {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(18, 35, 31, 0.96), rgba(7, 17, 15, 0.98));
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
}

.topbar {
  display: grid;
  grid-template-columns: 116px 230px minmax(360px, 1fr) 340px;
  gap: 12px;
  align-items: center;
  padding: 10px;
}

.home-link {
  min-height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
}

.kicker {
  display: block;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(84px, 1fr));
  border: 1px solid var(--line);
  background: rgba(6, 4, 3, 0.62);
}
.metrics div { padding: 8px 10px; border-right: 1px solid var(--line); }
.metrics div:last-child { border-right: 0; }
.metrics span { display: block; color: var(--muted); font-size: 0.72rem; }
.metrics strong { color: var(--gold); }

.top-actions { display: grid; grid-template-columns: 1.5fr 1fr; gap: 8px; }
button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-weight: 900;
}
.primary {
  border-color: rgba(109, 219, 209, 0.84);
  background: linear-gradient(180deg, #6ddbd1, #278579);
  color: #06100e;
}

.layout {
  min-height: 0;
  display: grid;
  grid-template-columns: 330px minmax(580px, 1fr) 360px;
  align-items: start;
  gap: 10px;
}

.panel {
  min-height: 0;
  padding: 12px;
  overflow: auto;
}

.panel-head,
.board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.panel-head span { color: var(--muted); font-weight: 900; }
.panel-head strong { color: var(--cyan); }
.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}
.replay-more {
  position: relative;
}
.replay-more summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.replay-more summary::-webkit-details-marker { display: none; }
.replay-more-menu {
  position: absolute;
  z-index: 20;
  right: 0;
  top: calc(100% + 6px);
  width: 160px;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(109, 219, 209, 0.26);
  border-radius: 8px;
  background: rgba(4, 14, 12, 0.96);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.34);
}
.replay-more-menu .mini {
  width: 100%;
  justify-content: center;
}

label {
  display: block;
  margin: 12px 0 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

textarea {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(6, 4, 3, 0.68);
  color: var(--text);
  padding: 10px;
  line-height: 1.5;
  outline: none;
}

.engine-only,
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(6, 4, 3, 0.68);
  color: var(--text);
  padding: 8px 10px;
  outline: none;
}

.hint-box {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid rgba(239, 184, 90, 0.3);
  border-radius: 8px;
  background: rgba(239, 184, 90, 0.08);
}
.hint-box strong { color: var(--gold); }
.hint-box p { margin-top: 6px; color: #f5dbb8; font-size: 0.82rem; line-height: 1.55; }

.arena-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}
.arena-steps span {
  min-height: 42px;
  display: grid;
  align-content: center;
  gap: 3px;
  border: 1px solid rgba(109, 219, 209, 0.18);
  border-radius: 7px;
  background: rgba(6, 4, 3, 0.36);
  color: #d8fffb;
  font-size: 0.72rem;
  font-weight: 900;
  padding: 7px;
}
.arena-steps b {
  color: var(--gold);
  font-size: 0.78rem;
}
.trust-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}
.trust-strip span {
  border: 1px solid rgba(127, 210, 138, 0.2);
  border-radius: 999px;
  background: rgba(127, 210, 138, 0.075);
  color: #d6ffdc;
  font-size: 0.7rem;
  font-weight: 900;
  padding: 4px 8px;
}

.console-card,
.coach-card,
.opponent-card {
  margin-top: 12px;
  border: 1px solid rgba(109, 219, 209, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(109, 219, 209, 0.08), rgba(7, 17, 15, 0.45));
  padding: 10px;
}
.console-card strong,
.coach-card strong,
.opponent-card strong {
  display: block;
  margin-top: 2px;
  color: var(--text);
}
.console-card p,
.coach-card p,
.opponent-card p {
  margin-top: 7px;
  color: #c8eee4;
  font-size: 0.8rem;
  line-height: 1.55;
}
.opponent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.opponent-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: 8px;
}
.opponent-meta span {
  border: 1px solid rgba(166, 244, 216, 0.14);
  border-radius: 6px;
  background: rgba(5, 12, 11, 0.5);
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 900;
  padding: 6px 8px;
}

.strategy-compare {
  margin-top: 12px;
  border: 1px solid rgba(109, 219, 209, 0.24);
  border-radius: 8px;
  background: rgba(109, 219, 209, 0.055);
  padding: 10px;
}
.advanced-card {
  margin-top: 12px;
  border: 1px solid rgba(166, 244, 216, 0.18);
  border-radius: 8px;
  background: rgba(6, 4, 3, 0.26);
  padding: 0;
}
.advanced-card summary,
.opponent-guide summary,
.strategy-lab summary {
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  color: var(--cyan);
  font-weight: 900;
  cursor: pointer;
}
.advanced-card[open],
.opponent-guide[open],
.strategy-lab[open] {
  padding: 0 10px 10px;
}
.advanced-card[open] summary,
.opponent-guide[open] summary,
.strategy-lab[open] summary {
  margin: 0 -10px 8px;
  border-bottom: 1px solid rgba(166, 244, 216, 0.14);
}
.strategy-lab {
  margin-top: 12px;
  border: 1px solid rgba(239, 184, 90, 0.3);
  border-radius: 8px;
  background: rgba(239, 184, 90, 0.06);
  padding: 10px;
}
.opponent-guide {
  margin-top: 12px;
  border: 1px solid rgba(127, 210, 138, 0.28);
  border-radius: 8px;
  background: rgba(127, 210, 138, 0.06);
  padding: 10px;
}
.opponent-guide .compare-head {
  margin-bottom: 6px;
}
.opponent-guide p {
  color: #d7f7db;
  font-size: 0.8rem;
  line-height: 1.55;
}
.wide-mini {
  width: 100%;
  margin-top: 8px;
}
.match-card {
  margin-top: 12px;
  border: 1px solid rgba(109, 219, 209, 0.3);
  border-radius: 8px;
  background: rgba(109, 219, 209, 0.055);
  padding: 10px;
}
.agent-roster-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-bottom: 8px;
}
.agent-roster-row select {
  min-width: 0;
}
.agent-avatar-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin: 8px 0 10px;
  padding: 9px;
  border: 1px solid rgba(109, 219, 209, 0.22);
  border-radius: 8px;
  background: rgba(6, 4, 3, 0.28);
}
.agent-avatar-preview {
  width: 72px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(240, 201, 106, 0.36);
  border-radius: 8px;
  background: radial-gradient(circle at 50% 36%, rgba(240, 201, 106, 0.2), rgba(6, 4, 3, 0.78));
  color: var(--gold);
  font-size: 1.7rem;
  font-weight: 900;
}
.agent-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.agent-avatar-preview span {
  transform: translateY(-1px);
}
.agent-avatar-body {
  min-width: 0;
}
.avatar-title {
  min-height: 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}
.avatar-change {
  min-height: 30px;
  padding: 5px 10px;
}
.avatar-picker {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(109, 219, 209, 0.16);
}
.avatar-picker[hidden] {
  display: none;
}
.avatar-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}
.avatar-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  min-height: 28px;
  padding: 5px 9px;
}
.avatar-upload input,
#agentAvatarUpload {
  display: none;
}
.avatar-library {
  max-height: 156px;
  display: grid;
  grid-template-columns: repeat(6, 34px);
  gap: 6px;
  overflow: auto;
  padding-right: 2px;
}
.avatar-choice {
  width: 34px;
  min-height: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 0;
  border-radius: 7px;
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--gold);
  font-size: 0.95rem;
}
.avatar-choice img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar-choice.active {
  border-color: rgba(240, 201, 106, 0.9);
  box-shadow: 0 0 0 2px rgba(240, 201, 106, 0.18);
}
.match-fields {
  display: grid;
  grid-template-columns: 1fr 112px;
  gap: 8px;
}
.match-fields label {
  margin: 0;
}
.match-fields input {
  margin-top: -2px;
}
.match-action {
  width: 100%;
  margin-top: 10px;
}
.match-status {
  margin-top: 8px;
  border: 1px solid rgba(245, 214, 171, 0.14);
  border-radius: 6px;
  background: rgba(6, 4, 3, 0.34);
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
  padding: 8px;
}
.match-status strong {
  color: var(--gold);
}
.match-status.good {
  border-color: rgba(127, 210, 138, 0.34);
  color: #d7f7db;
}
.match-status.warn {
  border-color: rgba(239, 184, 90, 0.34);
  color: #ffe3aa;
}
.strategy-lab label {
  margin-top: 10px;
}
.strategy-lab textarea {
  min-height: 210px;
}
.lab-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.compare-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.compare-head span {
  color: var(--cyan);
  font-weight: 900;
}
.compare-panel,
.compare-empty {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.5;
}
.compare-verdict {
  border: 1px solid rgba(245, 214, 171, 0.16);
  border-radius: 6px;
  padding: 8px;
  color: #ffe3aa;
  background: rgba(6, 4, 3, 0.38);
  font-weight: 900;
}
.compare-verdict.changed {
  border-color: rgba(127, 210, 138, 0.36);
  color: #d6ffdc;
  background: rgba(127, 210, 138, 0.08);
}
.compare-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 8px;
}
.compare-column {
  display: grid;
  gap: 6px;
}
.compare-column > strong {
  color: var(--gold);
  font-size: 0.78rem;
}
.compare-move {
  border: 1px solid rgba(245, 214, 171, 0.12);
  border-radius: 6px;
  padding: 7px;
  background: rgba(6, 4, 3, 0.34);
}
.compare-move.is-best {
  border-color: rgba(239, 184, 90, 0.36);
  background: rgba(239, 184, 90, 0.075);
}
.compare-move span,
.compare-move small {
  display: block;
}
.compare-move span {
  color: var(--text);
  font-weight: 900;
}
.compare-move em {
  display: block;
  margin-top: 3px;
  color: var(--gold);
  font-style: normal;
  font-size: 0.72rem;
}
.compare-move small {
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.4;
}

.board-panel {
  min-height: 0;
  position: sticky;
  top: 92px;
  height: calc(100vh - 104px);
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto 48px;
  gap: 10px;
  padding: 12px;
  overflow: hidden;
}

.timer-badge {
  border: 1px solid rgba(239, 184, 90, 0.38);
  border-radius: 999px;
  padding: 8px 14px;
  color: #ffe3aa;
  background: rgba(239, 184, 90, 0.09);
  font-weight: 900;
}

.xiangqi-wrap {
  min-height: 0;
  display: grid;
  place-items: start center;
  overflow: hidden;
}

.moment-banner {
  margin: 0 0 10px;
  border: 1px solid rgba(239, 184, 90, 0.44);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(184, 50, 36, 0.18), rgba(239, 184, 90, 0.16));
  box-shadow: 0 10px 28px rgba(239, 184, 90, 0.12);
  color: #ffe9bd;
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1.35;
  padding: 10px 12px;
}
.moment-banner[hidden] {
  display: none;
}
.moment-banner.pulse {
  animation: momentPulse 1.4s ease-out;
}
@keyframes momentPulse {
  0% { transform: translateY(-4px); opacity: 0; }
  18% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(0); opacity: 1; }
}

.battle-pulse {
  border: 1px solid rgba(109, 219, 209, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(199, 51, 40, 0.12), rgba(6, 4, 3, 0.42) 42%, rgba(109, 219, 209, 0.12));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
  padding: 10px 12px;
}
.pulse-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.pulse-copy span {
  color: var(--cyan);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}
.pulse-copy strong {
  color: #fff2c8;
  font-size: 0.92rem;
  line-height: 1.25;
  text-align: right;
  overflow-wrap: anywhere;
}
.pulse-meter {
  position: relative;
  height: 10px;
  display: flex;
  overflow: hidden;
  margin-top: 9px;
  border: 1px solid rgba(245, 214, 171, 0.16);
  border-radius: 999px;
  background: rgba(6, 4, 3, 0.62);
}
.pulse-meter i {
  display: block;
  transition: width 280ms ease;
}
#pulseRedBar {
  background: linear-gradient(90deg, rgba(199, 51, 40, 0.96), rgba(239, 184, 90, 0.72));
}
#pulseBlackBar {
  background: linear-gradient(90deg, rgba(109, 219, 209, 0.74), rgba(30, 38, 40, 0.98));
}
#pulseCenterMark {
  position: absolute;
  inset: -3px auto -3px 50%;
  width: 2px;
  background: rgba(255, 242, 200, 0.72);
  transform: translateX(-1px);
}
.pulse-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.pulse-stats span {
  border: 1px solid rgba(245, 214, 171, 0.12);
  border-radius: 999px;
  padding: 3px 7px;
  color: var(--muted);
  background: rgba(6, 4, 3, 0.32);
  font-size: 0.68rem;
  font-weight: 900;
}

#boardCanvas {
  width: min(100%, 620px);
  height: auto;
  max-height: 100%;
  aspect-ratio: 9 / 10;
  border: 1px solid rgba(245, 214, 171, 0.18);
  border-radius: 8px;
  background: #c99b62;
}

.thinking-panel {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(109, 219, 209, 0.22);
  border-radius: 8px;
  background: rgba(109, 219, 209, 0.07);
  padding: 9px 12px;
}
.thinking-panel span,
.thinking-panel strong,
.progress-line {
  display: block;
}
.thinking-panel span {
  color: var(--cyan);
  font-size: 0.7rem;
  font-weight: 900;
}
.thinking-panel strong {
  margin-top: 2px;
  color: var(--text);
  font-size: 0.9rem;
}
.progress-line {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.caster-line {
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid rgba(239, 184, 90, 0.28);
  border-radius: 8px;
  background: rgba(239, 184, 90, 0.08);
  color: #ffe3aa;
  font-weight: 900;
}

.move-feed {
  display: grid;
  gap: 8px;
}
.candidate-card {
  margin-bottom: 12px;
  border: 1px solid rgba(109, 219, 209, 0.25);
  border-radius: 8px;
  background: rgba(109, 219, 209, 0.055);
  padding: 10px;
}
.candidate-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.candidate-title span {
  color: var(--cyan);
  font-weight: 900;
}
.candidate-title strong {
  color: var(--muted);
  font-size: 0.76rem;
}
.candidate-list {
  display: grid;
  gap: 7px;
}
.candidate {
  border: 1px solid rgba(245, 214, 171, 0.13);
  border-radius: 7px;
  background: rgba(6, 4, 3, 0.38);
  padding: 8px;
}
.candidate.is-best {
  border-color: rgba(239, 184, 90, 0.42);
  background: rgba(239, 184, 90, 0.08);
}
.candidate-main {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}
.candidate-main strong {
  font-size: 0.82rem;
}
.candidate-main span {
  color: var(--gold);
  font-size: 0.74rem;
  font-weight: 900;
  white-space: nowrap;
}
.candidate-hits,
.candidate-empty {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
}
.highlight-card {
  margin-bottom: 12px;
  border: 1px solid rgba(239, 184, 90, 0.28);
  border-radius: 8px;
  background: rgba(239, 184, 90, 0.055);
  padding: 10px;
}
.highlight-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.highlight-title span {
  color: var(--gold);
  font-weight: 900;
}
.highlight-title strong {
  color: var(--cyan);
  font-size: 0.76rem;
}
.highlight-list {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.45;
}
.highlight-item {
  border: 1px solid rgba(245, 214, 171, 0.14);
  border-radius: 7px;
  background: rgba(6, 4, 3, 0.38);
  padding: 8px;
}
.highlight-item.red {
  border-left: 3px solid var(--red);
}
.highlight-item.black {
  border-left: 3px solid var(--black);
}
.highlight-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.highlight-main strong {
  color: var(--text);
  font-size: 0.82rem;
}
.highlight-main span {
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 900;
}
.highlight-item p {
  margin-top: 4px;
}
.highlight-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}
.highlight-tags em {
  border: 1px solid rgba(109, 219, 209, 0.22);
  border-radius: 999px;
  padding: 2px 6px;
  color: #d8fffb;
  background: rgba(109, 219, 209, 0.07);
  font-style: normal;
  font-size: 0.68rem;
}
.persona-stage {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.persona-card {
  border: 1px solid rgba(245, 214, 171, 0.15);
  border-radius: 7px;
  background: rgba(6, 4, 3, 0.34);
  padding: 9px;
}
.persona-card.red {
  border-left: 3px solid var(--red);
}
.persona-card.black {
  border-left: 3px solid var(--black);
}
.persona-card span,
.persona-card strong,
.persona-card p,
.banter-line {
  overflow-wrap: anywhere;
}
.persona-card span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}
.persona-card strong {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-size: 0.86rem;
}
.persona-card p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.45;
}
.banter-line {
  border: 1px solid rgba(239, 184, 90, 0.25);
  border-radius: 7px;
  background: rgba(239, 184, 90, 0.075);
  color: #ffe4b5;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.45;
  padding: 8px;
}
.archive-card {
  margin-top: 12px;
  border: 1px solid rgba(109, 219, 209, 0.2);
  border-radius: 8px;
  background: rgba(109, 219, 209, 0.045);
  padding: 10px;
}
.archive-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 0;
  cursor: pointer;
  list-style: none;
}
.archive-title::-webkit-details-marker { display: none; }
.archive-title span {
  color: var(--cyan);
  font-weight: 900;
}
.archive-title small {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
}
.archive-card[open] .archive-title {
  margin-bottom: 8px;
}
.archive-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}
.archive-list {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.45;
}
.archive-item {
  border: 1px solid rgba(245, 214, 171, 0.13);
  border-radius: 7px;
  background: rgba(6, 4, 3, 0.38);
  padding: 8px;
}
.archive-main,
.archive-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.archive-main strong {
  color: var(--text);
  font-size: 0.78rem;
}
.archive-main span {
  color: var(--muted);
  font-size: 0.68rem;
  white-space: nowrap;
}
.archive-meta {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 5px;
}
.archive-meta span {
  border: 1px solid rgba(109, 219, 209, 0.18);
  border-radius: 999px;
  padding: 2px 6px;
  color: #d8fffb;
  background: rgba(109, 219, 209, 0.06);
  font-size: 0.68rem;
}
.archive-item p {
  margin-top: 6px;
  color: var(--muted);
}
.public-result-card {
  margin-top: 12px;
  border: 1px solid rgba(109, 219, 209, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(109, 219, 209, 0.065), rgba(6, 4, 3, 0.44));
  padding: 10px;
}
.public-result-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.public-result-title span {
  color: var(--cyan);
  font-weight: 900;
}
.public-result-title strong {
  color: var(--gold);
  font-size: 0.72rem;
}
.public-result-grid {
  display: grid;
  gap: 7px;
}
.public-result-grid span {
  border: 1px solid rgba(245, 214, 171, 0.12);
  border-radius: 7px;
  background: rgba(6, 4, 3, 0.32);
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.45;
  padding: 8px;
}
.public-result-grid b {
  display: block;
  color: var(--text);
  margin-bottom: 2px;
}
.share-card {
  margin-top: 12px;
  border: 1px solid rgba(127, 210, 138, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(127, 210, 138, 0.075), rgba(6, 4, 3, 0.44));
  padding: 10px;
}
.share-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 0;
  cursor: pointer;
  list-style: none;
}
.share-title::-webkit-details-marker { display: none; }
.share-title span {
  color: var(--green);
  font-weight: 900;
}
.share-title strong {
  border: 1px solid rgba(127, 210, 138, 0.28);
  border-radius: 999px;
  padding: 3px 8px;
  color: #d6ffdc;
  background: rgba(127, 210, 138, 0.08);
  font-size: 0.7rem;
}
.share-card[open] .share-title {
  margin-bottom: 7px;
}
.share-card p,
.invite-status {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.5;
}
.share-preview {
  margin-top: 9px;
  border: 1px solid rgba(127, 210, 138, 0.2);
  border-radius: 7px;
  background: rgba(5, 12, 11, 0.46);
  color: #d6ffdc;
  font-size: 0.74rem;
  line-height: 1.5;
  white-space: pre-wrap;
  padding: 8px;
}
.invite-fields {
  display: grid;
  gap: 7px;
  margin-top: 9px;
}
.invite-fields label {
  margin: 0;
}
.invite-fields input[readonly] {
  color: #d6ffdc;
}
.reward-ladder {
  display: grid;
  gap: 6px;
  margin-top: 9px;
}
.reward-ladder span {
  border: 1px solid rgba(245, 214, 171, 0.13);
  border-radius: 6px;
  background: rgba(6, 4, 3, 0.34);
  color: #ffe3aa;
  font-size: 0.72rem;
  font-weight: 900;
  padding: 6px 8px;
}
.share-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 9px;
}
.link-mini {
  min-height: 30px;
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 900;
  text-decoration: none;
}
.invite-status {
  margin-top: 8px;
  border: 1px solid rgba(166, 244, 216, 0.12);
  border-radius: 6px;
  background: rgba(5, 12, 11, 0.44);
  padding: 7px 8px;
}
.move-item {
  border-left: 3px solid var(--gold);
  border-radius: 0 6px 6px 0;
  background: rgba(255, 255, 255, 0.045);
  padding: 9px 10px;
}
.move-item.red { border-left-color: var(--red); }
.move-item.black { border-left-color: var(--black); }
.move-item.good { border-left-color: var(--green); }
.move-item strong { display: block; font-size: 0.86rem; }
.move-item span { display: block; margin-top: 4px; color: var(--muted); font-size: 0.74rem; line-height: 1.45; }

.mini {
  min-height: 30px;
  padding: 0 10px;
  font-size: 0.76rem;
}

.replay-select {
  width: 92px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(6, 4, 3, 0.68);
  color: var(--text);
  font-weight: 900;
}

.final-panel {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(6, 4, 3, 0.54);
  padding: 12px;
}
.final-panel p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.55;
}
.turning-points {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.point {
  border: 1px solid rgba(127, 210, 138, 0.28);
  border-radius: 6px;
  padding: 8px;
  color: #d6ffdc;
  background: rgba(127, 210, 138, 0.07);
  font-size: 0.78rem;
  line-height: 1.45;
}
.improvement-panel {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.improvement-panel h3 {
  margin: 0;
  color: var(--gold);
  font-size: 0.86rem;
}
.suggestion {
  border: 1px solid rgba(109, 219, 209, 0.24);
  border-radius: 6px;
  padding: 8px;
  color: #d8fffb;
  background: rgba(109, 219, 209, 0.07);
  font-size: 0.76rem;
  line-height: 1.5;
}
.suggestion.coach {
  border-color: rgba(239, 184, 90, 0.34);
  color: #ffe4b5;
  background: rgba(239, 184, 90, 0.08);
}
.revenge-card {
  border: 1px solid rgba(199, 51, 40, 0.38);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(199, 51, 40, 0.13), rgba(239, 184, 90, 0.08));
  padding: 10px;
}
.revenge-card span,
.revenge-card strong,
.revenge-card p {
  display: block;
}
.revenge-card span {
  color: var(--gold);
  font-size: 0.68rem;
  font-weight: 900;
}
.revenge-card strong {
  margin-top: 4px;
  color: var(--text);
  font-size: 0.82rem;
  line-height: 1.4;
}
.revenge-card p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.45;
}

@media (max-width: 1180px) {
  .game-shell { grid-template-rows: auto auto; }
  .topbar, .layout { grid-template-columns: 1fr; }
  .board-panel { order: 1; }
  .strategy-panel { order: 2; }
  .feed-panel { order: 3; }
  .board-panel {
    position: static;
    height: auto;
  }
  .panel { overflow: visible; }
  #boardCanvas { width: min(100%, 520px); }
}
