:root {
  --bg-1: #1a2233;
  --bg-2: #0f1522;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-border: rgba(255, 255, 255, 0.1);
  --text-main: #eef2f8;
  --text-dim: #93a0b8;
  --accent: #e8b45a;
  --accent-hover: #f2c877;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  font-family: 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  color: var(--text-main);
  background: radial-gradient(1200px 700px at 20% 0%, #26314d 0%, var(--bg-1) 45%, var(--bg-2) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow-y: auto;
  -webkit-user-select: none;
  user-select: none;
}

.app {
  width: 100%;
  max-width: 1180px;
  padding: 28px 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.header {
  text-align: center;
  margin-bottom: 22px;
}

.title {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 12px;
  text-indent: 12px;
  background: linear-gradient(135deg, #f4d48c, #c8903e);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle {
  margin-top: 6px;
  font-size: 13px;
  letter-spacing: 6px;
  color: var(--text-dim);
}

.layout {
  display: flex;
  gap: 22px;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
}

.panel {
  width: 230px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.board-wrap {
  position: relative;
  border-radius: 16px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  line-height: 0;
}

#board {
  display: block;
  border-radius: 10px;
  cursor: pointer;
  touch-action: manipulation;
}

.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 16px;
}

.turn-card,
.score-card,
.stats {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 16px;
}

.turn-label {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 2px;
}

.turn-info {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.turn-text {
  font-size: 20px;
  font-weight: 600;
}

.stone-dot {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex: none;
}

.stone-dot.black {
  background: radial-gradient(circle at 35% 30%, #666, #0a0a0a);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.stone-dot.white {
  background: radial-gradient(circle at 35% 30%, #fff, #c6c6c6);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.stone-dot.large {
  width: 34px;
  height: 34px;
}

.stone-dot.sm {
  width: 14px;
  height: 14px;
}

.stats {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-label {
  color: var(--text-dim);
  font-size: 14px;
}

.stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn {
  width: 100%;
  padding: 11px 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 2px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  cursor: pointer;
  transition: background 0.18s ease, transform 0.12s ease;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.btn:active {
  transform: scale(0.97);
}

.btn.primary {
  background: linear-gradient(135deg, #e8b45a, #c8903e);
  color: #2a1f0c;
  letter-spacing: 4px;
}

.btn.primary:hover {
  background: linear-gradient(135deg, #f2c877, #d8a24a);
}

.btn.hidden {
  display: none;
}

.score-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 2px;
  margin-bottom: 12px;
}

.record-list {
  list-style: none;
  max-height: 220px;
  overflow-y: auto;
}

.record-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-main);
  padding: 7px 2px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
}

.record-empty {
  color: var(--text-dim);
  justify-content: center;
}

.winner-overlay {
  position: absolute;
  inset: 14px;
  border-radius: 10px;
  background: rgba(12, 16, 26, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
  animation: fade-in 0.35s ease;
}

.winner-overlay.hidden {
  display: none;
}

.winner-box {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.winner-text {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 6px;
  margin: 4px 0;
}

.winner-box .btn {
  width: 150px;
}

.footer {
  margin-top: 18px;
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 2px;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 860px) {
  .layout {
    flex-direction: column;
    align-items: center;
  }

  .panel {
    width: 100%;
    max-width: 420px;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .panel .card,
  .panel .turn-card,
  .panel .stats,
  .panel .score-card,
  .panel .controls {
    flex: 1;
    min-width: 180px;
  }

  .record-list {
    max-height: 120px;
  }

  .title {
    font-size: 32px;
  }
}
