* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Cantarell,
    sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}
.container {
  background: white;
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 1100px;
  width: 100%;
  display: flex;
  flex-direction: column;
  max-height: 95vh;
}
.muted {
  opacity: 0.7;
}
.header-row {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  flex-shrink: 0;
}
.header-title {
  flex-grow: 1;
}
.header-title h1 {
  margin-bottom: 4px;
  font-size: 24px;
}
.header-title .subtitle {
  margin: 0;
  color: #6b7280;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 20px;
}
.header-control-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.header-control-group label {
  font-size: 12px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.grid-size-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
}
.control-select {
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: white;
  outline: none;
}
.control-select:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.18);
}
button.primary {
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  background: #667eea;
  color: white;
  align-self: flex-end;
}
button.primary:hover {
  background: #5568d3;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}
.info-area {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 20px;
  align-items: start;
  margin-bottom: 20px;
  flex-shrink: 0;
}
.metrics-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.info-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px;
}
.info-card h3 {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.info-card .value {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
}
.results-table-wrap {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}
.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.results-table th,
.results-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}
.results-table thead th {
  position: sticky;
  top: 0;
  background: #f3f4f6;
  color: #374151;
}
.game-area {
  margin-top: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.grid-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: auto;
}
.grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-cols), var(--cell-size, 40px));
  grid-template-rows: repeat(var(--grid-rows), var(--cell-size, 40px));
  gap: 2px;
  padding: 2px;
  background: #d1d5db;
  border-radius: 8px;
  border: 2px solid #e5e7eb;
  flex-shrink: 0;
  width: max-content;
}
.cell {
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size, 20px);
  font-weight: bold;
  color: #1f2937;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  border-radius: 2px;
}
.cell.visited {
  outline: 2px solid rgba(59, 130, 246, 0.9);
  outline-offset: -2px;
}
.cell.in-group {
  background: #fbbf24;
  color: #78350f;
}
.cell:hover:not(.empty):not(.cell.in-group) {
  background: #e5e7eb;
  color: #4b5563;
}
.cell.empty {
  background: #e5e7eb;
  cursor: default;
  color: transparent;
}
.cell.empty:hover {
  transform: none;
  background: #e5e7eb;
}
.checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.checkbox-wrapper label {
  font-size: 14px;
  color: #374151;
  cursor: pointer;
}
.checkbox-wrapper input[type='checkbox'] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}
