* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f6f7fb;
  margin: 0;
  padding: 16px;
  color: #1f2330;
}
.wrap { max-width: 480px; margin: 0 auto; text-align: center; }
.status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 16px;
  font-weight: 600;
}
#newbtn {
  background: #4f46e5; color: white; border: 0; padding: 8px 14px;
  border-radius: 6px; cursor: pointer;
}
#newbtn:hover { background: #4338ca; }
.scoreline {
  display: flex; justify-content: center; gap: 18px;
  margin-bottom: 12px; font-weight: 600;
}
.score.blue { color: #2563eb; }
.score.red { color: #dc2626; }
.board {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: white;
  border-radius: 8px;
  padding: 12px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.board svg { width: 100%; height: 100%; display: block; }
.dot { fill: #1f2937; }
.line {
  stroke: #e5e7eb;
  stroke-width: 4;
  cursor: pointer;
}
.line:hover { stroke: #c7d2fe; }
.line.drawn-blue { stroke: #2563eb; stroke-width: 6; cursor: default; }
.line.drawn-red { stroke: #dc2626; stroke-width: 6; cursor: default; }
.box-label {
  font-size: 18px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
}
.box-label.blue { fill: #2563eb; }
.box-label.red { fill: #dc2626; }
.result {
  margin-top: 14px;
  padding: 12px;
  border-radius: 6px;
  font-size: 18px;
  font-weight: 600;
}
.result.win { background: #d1fae5; color: #065f46; }
.result.lose { background: #fee2e2; color: #991b1b; }
.result.draw { background: #fef3c7; color: #92400e; }
.result.hidden { display: none; }
.ai-thinking {
  text-align: center;
  padding: 6px 8px;
  margin-bottom: 8px;
  color: #6a4c93;
  font-weight: 600;
  font-size: 14px;
  animation: ai-pulse 1.2s ease-in-out infinite;
}
.ai-thinking[hidden] { display: none; }
@keyframes ai-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
