:root {
  --bg-page: #eef5fb;
  --bg-soft: #f7f2ea;
  --bg-panel: rgba(255, 255, 255, 0.78);
  --ink-strong: #19324a;
  --ink-soft: #5b7289;
  --ink-faint: #8ba1b4;
  --accent: #4e8cc8;
  --accent-strong: #2d6ba6;
  --board-line: #9eb8c8;
  --move-dot: rgba(78, 140, 200, 0.28);
  --surface-shadow: 0 24px 60px rgba(29, 65, 103, 0.18);
  --panel-radius: 28px;
  --card-radius: 20px;
  --pill-radius: 999px;
  --transition: 180ms ease;
  --font-display: "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
  --font-body: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--ink-strong);
  font-family: var(--font-body);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.68), rgba(238, 245, 251, 0.92)),
    url("./assets/surface-texture.png") center / 420px auto,
    linear-gradient(140deg, #edf6fb, #f8f0e9);
}

button,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

.page-shell {
  position: relative;
  min-height: 100vh;
  padding: 24px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1380px;
  margin: 0 auto 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffffff, #8fb9df);
  color: #4177b2;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.8), 0 10px 18px rgba(78, 140, 200, 0.28);
  font-size: 20px;
}

.brand h1,
.hero-copy h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-kicker,
.eyebrow,
.panel-kicker,
.field-label,
.mini-note {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.screen {
  max-width: 1380px;
  margin: 0 auto;
}

.is-hidden {
  display: none !important;
}

.hero-panel,
.board-shell,
.side-panel,
.modal-card {
  background: var(--bg-panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--surface-shadow);
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 28px;
  padding: 34px;
  border-radius: 36px;
  overflow: hidden;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.hero-copy h2 {
  font-size: clamp(2.1rem, 4vw, 4.4rem);
  line-height: 1.08;
}

.hero-text,
.field-hint,
.rules-grid p,
.info-block li,
#winnerSubtitle {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.75;
}

.field-group {
  display: grid;
  gap: 14px;
}

.field-header,
.panel-title-row,
.modal-head,
.modal-actions,
.player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.segmented-control {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.segment,
.primary-button,
.secondary-button,
.ghost-button,
.color-select {
  transition:
    transform var(--transition),
    box-shadow var(--transition),
    background-color var(--transition),
    border-color var(--transition),
    color var(--transition);
}

.segment,
.secondary-button,
.ghost-button,
.color-select {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(78, 140, 200, 0.18);
  color: var(--ink-strong);
}

.segment,
.primary-button,
.secondary-button,
.ghost-button {
  min-height: 48px;
  padding: 0 18px;
  border-radius: var(--pill-radius);
  font-weight: 600;
}

.segment:hover,
.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.color-select:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(78, 140, 200, 0.15);
}

.segment.is-active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 16px 28px rgba(78, 140, 200, 0.3);
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.color-card {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(78, 140, 200, 0.14);
}

.color-card-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.color-dot,
.winner-badge {
  border-radius: 50%;
  box-shadow: inset 0 2px 6px rgba(255, 255, 255, 0.85), 0 8px 18px rgba(31, 57, 82, 0.16);
}

.color-dot {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.color-select {
  width: 100%;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 14px;
  appearance: none;
}

.home-actions,
.action-stack {
  display: grid;
  gap: 12px;
}

.home-actions {
  grid-template-columns: repeat(2, minmax(0, 220px));
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  box-shadow: 0 16px 30px rgba(78, 140, 200, 0.28);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

.secondary-button {
  box-shadow: 0 10px 20px rgba(110, 142, 175, 0.12);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.46);
}

.ghost-button.wide,
.primary-button,
.secondary-button {
  width: 100%;
}

.hero-visual {
  display: grid;
  align-content: center;
  gap: 18px;
}

.hero-image-frame {
  position: relative;
  overflow: hidden;
  min-height: 420px;
  border-radius: 28px;
  background: linear-gradient(160deg, rgba(247, 242, 234, 0.8), rgba(226, 238, 250, 0.88));
}

.hero-image-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(25, 50, 74, 0.1));
}

.hero-image-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-badges span,
.turn-banner,
.status-card,
.player-row,
.winner-badge {
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(78, 140, 200, 0.16);
}

.hero-badges span {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--pill-radius);
  color: var(--ink-soft);
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}

.board-column {
  display: grid;
  gap: 16px;
}

.turn-banner {
  position: sticky;
  top: 12px;
  z-index: 5;
  min-height: 58px;
  padding: 14px 20px;
  border-radius: 20px;
  box-shadow: 0 16px 30px rgba(78, 140, 200, 0.12);
  font-size: 1rem;
  font-weight: 700;
}

.board-shell {
  position: relative;
  padding: 18px;
  border-radius: 36px;
  overflow: hidden;
}

.board-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.46), rgba(255, 255, 255, 0)),
    url("./assets/surface-texture.png") center / 360px auto;
  opacity: 0.28;
  pointer-events: none;
}

.board-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: min(76vh, 980px);
  border-radius: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.7), rgba(225, 237, 247, 0.7)),
    linear-gradient(160deg, rgba(245, 240, 233, 0.8), rgba(225, 237, 247, 0.75));
}

.board-svg {
  width: min(100%, 960px);
  height: auto;
  overflow: visible;
}

.side-panel {
  display: grid;
  gap: 16px;
  padding: 20px;
  border-radius: 28px;
}

.panel-block {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.62);
}

.status-card {
  min-height: 70px;
  padding: 14px 16px;
  border-radius: 18px;
  line-height: 1.7;
  font-weight: 600;
}

.player-list {
  display: grid;
  gap: 10px;
}

.player-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
}

.player-row.is-current {
  border-color: rgba(78, 140, 200, 0.42);
  box-shadow: 0 12px 24px rgba(78, 140, 200, 0.16);
}

.player-main {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
}

.player-meta {
  text-align: right;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.info-block ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 18px;
}

.modal-layer {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 31, 45, 0.36);
  backdrop-filter: blur(8px);
  z-index: 40;
}

.modal-card {
  width: min(760px, 100%);
  padding: 26px;
  border-radius: 30px;
}

.result-card {
  width: min(460px, 100%);
  display: grid;
  gap: 18px;
  justify-items: center;
  text-align: center;
}

.modal-head {
  align-items: start;
  margin-bottom: 18px;
}

.modal-head h3,
.result-card h3 {
  margin: 6px 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 2vw, 2.2rem);
}

.modal-body {
  display: grid;
  gap: 18px;
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.rules-grid article {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.62);
}

.rules-grid h4 {
  margin: 0 0 8px;
}

.winner-badge {
  width: 74px;
  height: 74px;
}

.modal-actions {
  width: 100%;
}

.modal-actions .primary-button,
.modal-actions .secondary-button {
  flex: 1;
}

.board-cell {
  transition:
    transform 140ms ease,
    opacity 140ms ease,
    filter 140ms ease,
    stroke-width 140ms ease;
}

.board-hole {
  fill: rgba(255, 255, 255, 0.58);
  stroke: rgba(121, 157, 181, 0.58);
  stroke-width: 1.2;
}

.board-link {
  stroke: rgba(145, 174, 191, 0.45);
  stroke-width: 1.4;
}

.piece-shadow {
  opacity: 0.18;
}

.piece-core {
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 2;
}

.piece-selected .piece-core {
  stroke: rgba(25, 50, 74, 0.92);
  stroke-width: 3.4;
  filter: drop-shadow(0 0 14px rgba(78, 140, 200, 0.45));
}

.piece-current {
  cursor: pointer;
}

.piece-current:hover {
  transform: translateY(-2px) scale(1.04);
}

.move-marker {
  cursor: pointer;
}

.move-marker .move-dot {
  fill: var(--move-dot);
  stroke: rgba(78, 140, 200, 0.52);
  stroke-width: 1.8;
}

.move-marker.jump-only .move-dot {
  fill: rgba(111, 179, 102, 0.28);
  stroke: rgba(71, 182, 122, 0.56);
}

.move-marker:hover .move-dot {
  transform: scale(1.12);
}

.board-cell.is-blocked {
  cursor: not-allowed;
  opacity: 0.76;
}

@media (max-width: 1099px) {
  .hero-panel,
  .game-layout {
    grid-template-columns: 1fr;
  }

  .hero-image-frame {
    min-height: 320px;
  }

  .board-stage {
    min-height: auto;
    padding: 10px 0;
  }
}

@media (max-width: 699px) {
  .page-shell {
    padding: 16px;
  }

  .site-header {
    align-items: flex-start;
  }

  .hero-panel,
  .board-shell,
  .side-panel,
  .modal-card {
    border-radius: 24px;
  }

  .hero-panel {
    padding: 22px;
  }

  .home-actions,
  .rules-grid,
  .modal-actions {
    grid-template-columns: 1fr;
  }

  .color-grid {
    grid-template-columns: 1fr;
  }

  .turn-banner {
    top: 8px;
    font-size: 0.95rem;
  }

  .board-shell {
    padding: 12px;
  }

  .board-svg {
    width: 100%;
  }

  .player-row {
    grid-template-columns: 1fr;
  }
}
