* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  font-family: system-ui, sans-serif;
  background-color: #f5f5f5;
  color: #1a1a1a;
}

header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

#score-display,
#timer-display {
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}

footer {
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  color: #6b7280;
}

button {
  font-size: 1rem;
  padding: 0.5rem 1.25rem;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

.mode-buttons {
  display: flex;
  gap: 0.5rem;
}

.mode-buttons button {
  background-color: #e5e7eb;
  color: #1a1a1a;
}

.mode-buttons button.active {
  background-color: #1a1a1a;
  color: #ffffff;
}

.grid {
  display: grid;
  grid-template-columns: repeat(var(--size), 3rem);
  grid-template-rows: repeat(var(--size), 3rem);
  gap: 2px;
  background-color: #1a1a1a;
  padding: 2px;
}

.cell-wrapper {
  position: relative;
}

.cell {
  width: 100%;
  height: 100%;
  border: none;
  text-align: center;
  font-size: 1.5rem;
  text-transform: uppercase;
  background-color: #ffffff;
  color: #1a1a1a;
}

.letter-value {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 0.65rem;
  line-height: 1;
  color: #4b5563;
  pointer-events: none;
}

.cell:focus {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
}

.cell--starter {
  background-color: #e5e7eb;
  font-weight: bold;
}

.cell--invalid {
  background-color: #fecaca;
}

.cell--blocked {
  background-color: #1a1a1a;
}

#submit-button {
  background-color: #2563eb;
  color: #ffffff;
}

#submit-button:disabled {
  background-color: #9ca3af;
}

dialog#definition-dialog {
  width: min(24rem, 90vw);
  border: none;
  border-radius: 0.5rem;
  padding: 1.5rem;
}

dialog#definition-dialog::backdrop {
  background-color: rgb(0 0 0 / 50%);
}

#definition-content h2 {
  margin: 0 0 0.25rem;
  text-transform: capitalize;
}

#definition-content .definition-phonetic {
  margin: 0 0 1rem;
  color: #6b7280;
  font-style: italic;
}

#definition-content .definition-part-of-speech {
  margin: 1rem 0 0.25rem;
  font-weight: bold;
  text-transform: capitalize;
}

#definition-content ol {
  margin: 0;
  padding-left: 1.25rem;
}

.definition-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

#definition-search-link {
  font-size: 0.9rem;
  color: #2563eb;
  text-decoration: none;
}

#definition-search-link:hover {
  text-decoration: underline;
}

dialog#definition-dialog button {
  background-color: #e5e7eb;
  color: #1a1a1a;
}
