/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

body {
  color: #1f2933;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.4;
  margin: 2rem;
}

a,
button,
input[type="submit"] {
  font: inherit;
}

table {
  border-collapse: collapse;
  margin-top: 1rem;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid #d8dee4;
  padding: 0.75rem;
  text-align: left;
  vertical-align: top;
}

td form {
  display: inline;
}

.flash,
.errors {
  border-radius: 6px;
  margin: 1rem 0;
  padding: 0.75rem 1rem;
}

.flash-alert,
.errors {
  background: #fff1f2;
  color: #9f1239;
}

.flash-notice {
  background: #ecfdf3;
  color: #027a48;
}

.field,
.actions {
  margin: 1rem 0;
}

.generation-panel {
  background: #f8fafc;
  border: 1px solid #d8dee4;
  border-radius: 6px;
  margin: 1.5rem 0;
  padding: 1rem;
}

.generation-panel h2,
.generation-panel p {
  margin-top: 0;
}

progress {
  vertical-align: middle;
}

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.puzzle-editor,
.puzzle-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  margin: 1.5rem 0;
}

.sudoku-grid {
  display: grid;
  grid-template-columns: repeat(9, 2.5rem);
  grid-template-rows: repeat(9, 2.5rem);
  width: max-content;
}

.sudoku-grid-game {
  grid-template-columns: repeat(9, 3.75rem);
  grid-template-rows: repeat(9, 3.75rem);
}

.sudoku-square {
  border: 1px solid #a7b0ba;
  box-sizing: border-box;
  display: grid;
  height: 3.75rem;
  position: relative;
  width: 3.75rem;
}

.sudoku-cell {
  align-items: center;
  border: 1px solid #a7b0ba;
  box-sizing: border-box;
  display: flex;
  font-size: 1.2rem;
  height: 2.5rem;
  justify-content: center;
  text-align: center;
  width: 2.5rem;
}

input.sudoku-cell {
  caret-color: transparent;
  padding: 0;
}

.sudoku-square .sudoku-cell {
  background: transparent;
  border: 0;
  font-size: 1.55rem;
  grid-area: 1 / 1;
  height: 100%;
  position: relative;
  width: 100%;
  z-index: 1;
}

.sudoku-square:nth-child(3n),
.sudoku-cell:nth-child(3n) {
  border-right-color: #4b5563;
  border-right-width: 3px;
}

.sudoku-square:nth-child(9n),
.sudoku-cell:nth-child(9n) {
  border-right-color: #4b5563;
  border-right-width: 3px;
}

.sudoku-square:nth-child(n + 19):nth-child(-n + 27),
.sudoku-square:nth-child(n + 46):nth-child(-n + 54),
.sudoku-cell:nth-child(n + 19):nth-child(-n + 27),
.sudoku-cell:nth-child(n + 46):nth-child(-n + 54) {
  border-bottom-color: #4b5563;
  border-bottom-width: 3px;
}

.sudoku-square:nth-child(-n + 9),
.sudoku-cell:nth-child(-n + 9) {
  border-top-color: #4b5563;
  border-top-width: 3px;
}

.sudoku-square:nth-child(9n + 1),
.sudoku-cell:nth-child(9n + 1) {
  border-left-color: #4b5563;
  border-left-width: 3px;
}

.sudoku-square:nth-child(n + 73),
.sudoku-cell:nth-child(n + 73) {
  border-bottom-color: #4b5563;
  border-bottom-width: 3px;
}

.sudoku-notes {
  color: #9aa4b2;
  display: grid;
  font-size: 0.68rem;
  font-weight: 600;
  grid-area: 1 / 1;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  line-height: 1;
  pointer-events: none;
}

.sudoku-note {
  align-items: center;
  display: flex;
  justify-content: center;
  position: relative;
}

.game-page {
  max-width: 48rem;
}

.game-header {
  margin-bottom: 1.5rem;
}

.game-header h1 {
  margin-bottom: 0.25rem;
}

.game-title {
  align-items: center;
  display: flex;
  gap: 0.6rem;
}

.game-title-icon {
  flex: 0 0 auto;
  height: 1.25em;
  width: 1.25em;
}

.game-header p {
  color: #52616f;
  margin-top: 0;
}

.game-start,
.game-board,
.game-complete {
  display: grid;
  gap: 1rem;
}

.elapsed-timer {
  align-items: baseline;
  display: flex;
  gap: 0.5rem;
}

.elapsed-timer span {
  color: #52616f;
  font-weight: 600;
}

.elapsed-timer time {
  color: #111827;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.note-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.note-toggle {
  background: #f8fafc;
  border: 1px solid #a7b0ba;
  border-radius: 6px;
  color: #1f2933;
  cursor: pointer;
  padding: 0.45rem 0.75rem;
}

.note-toggle-active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.note-toggle:disabled {
  color: #7b8794;
  cursor: not-allowed;
  opacity: 0.72;
}

.replay-controls {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.replay-controls button,
.replay-controls select {
  background: #f8fafc;
  border: 1px solid #a7b0ba;
  border-radius: 6px;
  color: #1f2933;
  cursor: pointer;
  padding: 0.45rem 0.75rem;
}

.replay-controls label {
  align-items: center;
  color: #52616f;
  display: flex;
  font-weight: 600;
  gap: 0.35rem;
}

.replay-controls output {
  color: #111827;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.sudoku-cell-given,
input.sudoku-cell[readonly] {
  background: #eef2f6;
  color: #111827;
  font-weight: 700;
}

.sudoku-square .sudoku-cell-replay-editable[readonly] {
  background: transparent;
  color: #111827;
  font-weight: 400;
}

.sudoku-cell.sudoku-cell-active,
input.sudoku-cell[readonly].sudoku-cell-active {
  background: #eaf3ff;
  outline: 3px solid #2563eb;
  outline-offset: 0;
  position: relative;
  z-index: 2;
}

.sudoku-square:has(.sudoku-cell-active) {
  z-index: 2;
}

.sudoku-square .sudoku-cell.sudoku-cell-active {
  background: rgba(234, 243, 255, 0.62);
}

.sudoku-square:has(.sudoku-cell-active) .sudoku-notes {
  color: #4b5563;
}

.replay-board .sudoku-square-active .sudoku-notes {
  color: #374151;
  position: relative;
  z-index: 3;
}

.empty-state {
  background: #f8fafc;
  border: 1px solid #d8dee4;
  border-radius: 6px;
  padding: 1rem;
}
