@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;600;700&family=ZCOOL+XiaoWei&display=swap');

:root {
  --xq-ink: #1d1a16;
  --xq-ink-soft: #2a2622;
  --xq-paper: #f6efe4;
  --xq-parchment: #efe5d3;
  --xq-gold: #d8b36a;
  --xq-river: #26657a;
  --xq-red: #b3392e;
  --xq-black: #1f1e1c;
  --xq-slate: #4c5b55;
  --xq-shadow: rgba(16, 16, 16, 0.18);
}

.xq-app {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  color: var(--xq-ink);
  background: radial-gradient(circle at 15% 20%, rgba(216, 179, 106, 0.18), transparent 55%),
    radial-gradient(circle at 85% 15%, rgba(38, 101, 122, 0.16), transparent 45%),
    linear-gradient(140deg, #f8f2e7 0%, #efe5d3 45%, #f2ece0 100%);
  padding: 36px clamp(18px, 4vw, 56px) 64px;
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(17, 16, 14, 0.12);
}

.xq-hero {
  display: grid;
  grid-template-columns: minmax(240px, 1.2fr) minmax(200px, 0.8fr);
  gap: 24px;
  align-items: center;
  margin-bottom: 28px;
}

.xq-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--xq-slate);
  margin-bottom: 8px;
}

.xq-hero h1 {
  font-family: 'ZCOOL XiaoWei', 'Noto Serif SC', serif;
  font-size: clamp(2.3rem, 4vw, 3.6rem);
  margin: 0 0 12px;
  color: var(--xq-ink);
}

.xq-hero p {
  font-size: 1.05rem;
  color: var(--xq-ink-soft);
  margin: 0;
}

.xq-legend {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(31, 30, 28, 0.08);
  border-radius: 18px;
  padding: 18px 20px;
  box-shadow: 0 12px 24px rgba(17, 16, 14, 0.08);
}

.xq-legend-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 12px;
}

.xq-legend-items {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  font-size: 0.9rem;
  color: var(--xq-ink-soft);
}

.xq-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  grid-template-areas: "board sidebar";
  gap: 28px;
  align-items: start;
}

.xq-sidebar {
  grid-area: sidebar;
  display: grid;
  gap: 18px;
  align-content: start;
}

.xq-board-wrap {
  grid-area: board;
  display: grid;
  gap: 20px;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
}

.xq-panel {
  background: rgba(255, 255, 255, 0.78);
  border-radius: 18px;
  padding: 18px 20px;
  border: 1px solid rgba(31, 30, 28, 0.08);
  box-shadow: 0 16px 28px rgba(16, 16, 16, 0.08);
}

.xq-panel-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 10px;
  color: var(--xq-ink);
}

.xq-status {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--xq-ink);
}

.xq-check {
  margin-top: 6px;
  font-size: 0.95rem;
  color: var(--xq-red);
  font-weight: 600;
}

.xq-check.is-hidden {
  display: none;
}

.xq-buttons {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.xq-btn {
  border: 1px solid rgba(31, 30, 28, 0.2);
  background: #f7f1e6;
  color: var(--xq-ink);
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.xq-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(16, 16, 16, 0.12);
}

.xq-btn:active {
  transform: translateY(0);
}

.xq-btn-primary {
  background: linear-gradient(135deg, #b3392e, #e07a5f);
  color: #fff;
  border: none;
}

.xq-btn.is-active {
  background: #e8ddc7;
  border-color: rgba(31, 30, 28, 0.35);
}

.xq-captured {
  display: grid;
  gap: 12px;
}

.xq-captured-row {
  display: grid;
  gap: 8px;
}

.xq-captured-label {
  font-size: 0.85rem;
  color: var(--xq-slate);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.xq-captured-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.xq-captured-piece {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-family: 'ZCOOL XiaoWei', 'Noto Serif SC', serif;
  font-size: 0.95rem;
  border: 1px solid rgba(31, 30, 28, 0.2);
  background: #f7f1e6;
}

.xq-captured-piece.xq-red {
  color: var(--xq-red);
  border-color: rgba(179, 57, 46, 0.4);
}

.xq-captured-piece.xq-black {
  color: var(--xq-black);
  border-color: rgba(31, 30, 28, 0.4);
}

.xq-board-card {
  background: linear-gradient(160deg, rgba(247, 241, 230, 0.95), rgba(236, 224, 203, 0.95));
  border-radius: 24px;
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid rgba(31, 30, 28, 0.08);
  box-shadow: 0 20px 40px rgba(17, 16, 14, 0.12);
  animation: xq-rise 0.6s ease both;
  width: 100%;
}

.xq-board {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  aspect-ratio: 9 / 10;
}

.xq-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.xq-lines {
  stroke: rgba(29, 26, 22, 0.72);
  stroke-width: 3;
  stroke-linecap: round;
}

.xq-lines .xq-border {
  stroke-width: 4;
}

.xq-river {
  font-family: 'ZCOOL XiaoWei', 'Noto Serif SC', serif;
  font-size: 42px;
  fill: rgba(38, 101, 122, 0.6);
  letter-spacing: 4px;
}

.xq-point-hit {
  fill: transparent;
  cursor: pointer;
}

.xq-point-dot {
  fill: rgba(38, 101, 122, 0.25);
  opacity: 0;
  transform-origin: center;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.xq-point.is-legal .xq-point-dot {
  opacity: 1;
  transform: scale(1.15);
}

.xq-point.is-capture .xq-point-dot {
  fill: transparent;
  stroke: rgba(179, 57, 46, 0.65);
  stroke-width: 4;
}

.xq-piece {
  cursor: pointer;
  transition: transform 0.2s ease;
}

.xq-piece circle {
  filter: drop-shadow(0 6px 8px rgba(16, 16, 16, 0.2));
}

.xq-piece text {
  font-family: 'ZCOOL XiaoWei', 'Noto Serif SC', serif;
  font-size: 42px;
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: middle;
}

.xq-piece.xq-red circle {
  fill: #fdf6ee;
  stroke: rgba(179, 57, 46, 0.8);
  stroke-width: 4;
}

.xq-piece.xq-black circle {
  fill: #f5f2ec;
  stroke: rgba(31, 30, 28, 0.75);
  stroke-width: 4;
}

.xq-piece.xq-red text {
  fill: var(--xq-red);
}

.xq-piece.xq-black text {
  fill: var(--xq-black);
}

.xq-piece.is-selected circle {
  stroke: var(--xq-gold);
  stroke-width: 6;
  filter: drop-shadow(0 10px 12px rgba(216, 179, 106, 0.5));
}

.xq-piece.is-selected {
  transform: scale(1.03);
}

.xq-highlight circle {
  fill: rgba(216, 179, 106, 0.18);
  stroke: rgba(216, 179, 106, 0.85);
  stroke-width: 4;
}

.xq-board-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  font-size: 0.95rem;
  color: var(--xq-ink-soft);
  gap: 12px;
}

.xq-turn-indicator {
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(31, 30, 28, 0.08);
}

.xq-turn-indicator.is-red {
  color: var(--xq-red);
  background: rgba(179, 57, 46, 0.12);
}

.xq-turn-indicator.is-black {
  color: var(--xq-black);
  background: rgba(31, 30, 28, 0.12);
}

.xq-moves {
  max-height: 320px;
  overflow: hidden;
}

.xq-move-list {
  margin: 0;
  padding-left: 22px;
  max-height: 260px;
  overflow-y: auto;
  color: var(--xq-ink-soft);
}

.xq-move-list li {
  margin-bottom: 6px;
  font-size: 0.9rem;
}

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

@media (max-width: 980px) {
  .xq-hero {
    grid-template-columns: 1fr;
  }

  .xq-shell {
    grid-template-columns: 1fr;
    grid-template-areas: "board" "sidebar";
  }

  .xq-board {
    width: min(92vw, 680px);
  }

  .xq-board-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .xq-app {
    padding: 28px 16px 48px;
  }

  .xq-board {
    width: 100%;
  }

  .xq-moves {
    max-height: none;
  }
}
