* { 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: 12px;
  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; }
.board {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  background: #2563eb;
  padding: 8px;
  border-radius: 8px;
  aspect-ratio: 7/6;
  user-select: none;
}
.slot {
  background: white;
  border-radius: 50%;
  aspect-ratio: 1;
  cursor: pointer;
  transition: transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.slot.red { background: #ef4444; }
.slot.yellow { background: #facc15; }
.slot.win { box-shadow: 0 0 0 3px #fff inset, 0 0 0 5px #10b981 inset; }
.col-hover .slot.preview { background: #fecaca; }
.result {
  margin-top: 16px;
  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; }
.difficulty { display: flex; gap: 4px; padding: 8px 0; justify-content: center; margin-bottom: 4px; }
.difficulty button {
  padding: 6px 14px; border-radius: 8px; border: 0;
  background: rgba(0,0,0,0.08); cursor: pointer; font-weight: 600;
  font-family: inherit; font-size: 14px; touch-action: manipulation;
}
.difficulty button.active { background: #6a4c93; color: white; }
.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; }
}
