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

body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
}

.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #f8fafc;
}

.stats {
  display: flex;
  gap: 48px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #64748b;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #f1f5f9;
}

#board {
  position: relative;
  width: 364px;
  height: 364px;
  background: #1e293b;
  border-radius: 16px;
  padding: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.tile {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 80px;
  height: 80px;
  background: #3b82f6;
  color: #ffffff;
  font-size: 1.5rem;
  font-weight: 700;
  border-radius: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  user-select: none;
  transition: transform 0.12s ease;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.tile:hover {
  background: #2563eb;
  box-shadow: 0 6px 18px rgba(59, 130, 246, 0.5);
}

.tile:active {
  background: #1d4ed8;
}

.controls {
  display: flex;
  gap: 12px;
}

button {
  padding: 10px 28px;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: #1e40af;
  color: #e2e8f0;
  letter-spacing: 0.03em;
  transition: background 0.1s, transform 0.05s;
}

button:hover {
  background: #1d4ed8;
}

button:active {
  background: #1e3a8a;
  transform: translateY(1px);
}

.best {
  font-size: 0.85rem;
  color: #64748b;
}

.hidden {
  display: none !important;
}

#win-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(4px);
}

.win-modal {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 20px;
  padding: 40px 56px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}

.win-title {
  font-size: 2.5rem;
  font-weight: 800;
  color: #fbbf24;
  letter-spacing: 0.05em;
}

.win-result {
  font-size: 1.25rem;
  color: #cbd5e1;
}

.win-record {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fbbf24;
  min-height: 1.4em;
}

#win-overlay button {
  margin-top: 8px;
  padding: 12px 40px;
  font-size: 1rem;
  background: #3b82f6;
}

#win-overlay button:hover {
  background: #2563eb;
}
