.candidate-green {
  background-color: #3ec46d !important;
}

.candidate-red {
  background-color: #e74c3c !important;
}

/* Layout & Containers */

@media (max-width: 1049px) {
  main {
    padding-top: 2px;

  }
}

main {
  padding-top: 5px;
}

/* .sudoku-main-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
} */
/* Default: stacked layout */
.sudoku-main-layout {

  /* grid-template-columns: 1fr;
  gap: 32px;
  align-items: center;
  justify-content: center; */
}

/* Desktop: side-by-side layout */
@media (min-width: 1050px) {
  .sudoku-main-layout {
    display: grid;
    grid-template-columns: auto auto;
    align-items: flex-start;
    justify-content: center;
    gap: 32px;
  }
}

.sudoku-app-main {
  /* margin: 0 auto; */
  display: flex;
  justify-content: center;
}


/* Board */
.sudoku-board {
  top: 0px;
  width: 100vw;
  max-width: 772px;
  max-height: 772px;
  aspect-ratio: 1 / 1;
  position: relative;
  background: #5b5b5b;
  margin-top: 5px;
  margin-bottom: 5px;
}

.sudoku-board-outline {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  outline: 5px solid #5b5b5b;
}

/* cells */
.sudoku-cell {
  position: absolute;
  color: black;
  outline: 1px solid rgb(140, 140, 140);
  transform: scale3d(1, 1, 1);
  background-color: white;
}

.sudoku-cell__value>path {
  fill: black;
}

.sudoku-cell.prefilled {
  background-color: #dfdfdf;
}

.sudoku-cell.highlight-row {
  background-color: #e6f7ff !important;
}

.sudoku-cell.highlight-col {
  background-color: #e6f7ff !important;
}

.sudoku-cell.highlight-same-candidate {
  background-color: #b3e6ff !important;
}

.sudoku-cell.selected {
  background-color: #b3e6ff !important;
}

.sudoku-cell.incorrect {
  background-color: #ffb3b3 !important;
  border: 2px solid #ff3333 !important;
}

.sudoku-cell.pre-filled {
  background-color: #dfdfdf;
}


/* Candidate / Notes */
.sudoku-candidate {
  pointer-events: none;
  box-sizing: inherit;
  z-index: 2;
}

.sudoku-candidate {
  pointer-events: none;
  position: absolute;
}

.sudoku-candidates>svg>path {
  pointer-events: none;
  fill: #5a5a5a;
}

.sudoku-candidate-button {
  position: absolute;
  opacity: 0;
  transition: opacity 400ms ease;
  transition-delay: 300ms;
}

.sudoku-candidate-button:hover {
  opacity: .4;
  transition-delay: 0ms;
}

.sudoku-candidate-button:hover {
  cursor: pointer;
  background-color: red;
}

.sudoku-candidate:not(.selected) .sudoku-candidate-button {
  opacity: 0 !important;
  pointer-events: none !important;
}

.sudoku-candidate.selected .sudoku-candidate-button {
  opacity: 0;
  pointer-events: auto;
  transition: opacity 400ms ease;
  transition-delay: 300ms;
}

.sudoku-candidate.selected .sudoku-candidate-button:hover {
  opacity: 0.4;
  transition-delay: 0ms;
  cursor: pointer;
  background-color: red;
}

.sudoku-candidate.highlight-same-candidate {
  background-color: #b3e6ff !important;
}


/* Keyboard */
.sudoku-keyboard {
  margin: 15px auto;
}

.sudoku-keyboard__row {
  /* margin-top: 30px; */
  display: flex;
  justify-content: center;
  gap: 5px;
  flex-wrap: wrap;
}

.sudoku-keyboard__number {
  width: 70px;
  height: 70px;
  position: relative;
  background-color: #dfdfdf;

}

/* @media (min-width: 600px) { */
.sudoku-keyboard {
  max-width: 260px;
}

.sudoku-notes-keyboard {
  max-width: 260px;
  margin: 0 auto;
}

.sudoku-notes-keyboard .tile {
  background: rgb(189, 189, 249);
}

.sudoku-keyboard__row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.sudoku-keyboard__number {
  width: auto;
  height: 80px;
  font-size: 2em;
}

/* } */

.sudoku-keyboard-layout {
  display: flex;
  flex-direction: column;
  /* Default: stacked for desktop */
  align-items: center;
  width: 100%;
}

@media (max-width: 1049px) {
  .sudoku-keyboard-layout {
    flex-direction: row;
    /* On mobile: side by side */
    align-items: flex-start;
    justify-content: space-around;
    /* justify-content: center; */
    /* gap: 40px; */
    padding: 12px 5px 0 5px;
    /* top, right, bottom, left */
  }

  .sudoku-action-section {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    min-width: 90px;
  }

  .sudoku-timer {
    margin-bottom: 8px;
    /* Optional: style the timer for mobile */
    text-align: center;
    font-size: 1.1em;
  }

  .sudoku-action-buttons {
    min-width: 90px;
    /* Adjust as needed */
    margin: 0;
    order: 1;
    /* Show first (left) */
  }

  .sudoku-keyboard {
    margin: 0;
    order: 2;
    /* Show second (right) */
  }
}

@media (min-width: 1049px) {
  .sudoku-keyboard-layout {
    flex-direction: column;
  }

  .sudoku-action-buttons {
    order: 1;
  }

  .sudoku-keyboard {
    order: 2;
  }
}


/* Keyboard Tiles */


.tile {
  width: 80px;
  height: 80px;
  background: white;
  border-radius: 5px;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 2px solid black;
}

/* @media (min-width: 600px) {
.tile {
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 5px;
    position: relative; 
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid black;
}
} */
.sudoku-keyboard.candidate-mode .tile {
  background-color: #cbe2ff;
  transition: background 0.2s;
}

.tile:hover {
  cursor: pointer;
  background: rgb(239, 239, 239);
}

.tile:active {
  background: rgb(220, 220, 220);
}

.sudoku-keyboard.candidate-mode .tile:hover {
  background-color: #4692ef;
  transition: background 0.2s;
}

.sudoku-keyboard.candidate-mode .tile:active {
  background-color: #9fc8fa;
  transition: background 0.2s;
}

.tile::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 7px;
  background-color: #abafb2;
  border-top: 1px solid #e9ecef;
  border-bottom-left-radius: 2px;
  border-bottom-right-radius: 2px;
}

.tile__letter {
  font-size: 2rem;
  font-weight: 700;
  color: #2d3436;
  position: relative;
  z-index: 1;
  margin-bottom: 3px;
}

.tile__number {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 1rem;
  font-weight: 600;
  color: #2d3436;
  z-index: 1;
}

.sudoku-keyboard .tile.all-placed {
  background-color: #ededed !important;
  color: #222;
}

.tile-corner-number {
  position: absolute;
  top: 3px;
  right: 6px;
  font-size: 0.4em;
  color: #222;
  pointer-events: none;
  z-index: 2;
  font-family: Arial, sans-serif;
}

.tile {
  position: relative;
}

.sudoku-action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 8px;
  margin-top: 25px;
  margin: 0 auto;
}

#toggle-candidate-mode {
  width: 100%;
  grid-column: 1 / span 2;
  /* spans both columns */
}

#undo-btn {
  width: 100%;
  grid-column: 1;
  grid-row: 2;
}

#erase-btn {
  width: 100%;
  grid-column: 2;
  grid-row: 2;
}

.difficulty-selector {
  margin-top: 15px;
  max-width: 155px;
  /* margin: 15px auto; */
  /* text-align: center; */
}

@media (max-width: 1049px) {
  .difficulty-selector {
    margin-top: 15px;
    max-width: 155px;
    margin: 15px auto;
    text-align: center;
  }
}



/* Timer */
.sudoku-timer {
  text-align: center;
  font-size: 1.5em;
  /* margin: 15px 0px 0px 0px; */
}

@media (max-width: 1049px) {
  .sudoku-timer {
    font-size: 1em;
  }
}


/* Utilities / Stretch */
.su-stretch {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

@media (max-width: 1049px) {

  /* .responsive_horizontal {
    display: none;
  } */
  .responsive_square {
    display: none;
  }
}


/* for videos */

#sudoku-timer {
  display: none;
}

.sudoku-keyboard-layout {
  /* margin-bottom: 500px; */
}

.cozy-theme #sudoku-board {
  /* background: #fdf6e3; */
  /* border-color: #deb887; */
  /* Add more cozy styles here */
}

.cozy-theme header .container {
  background-color: #f8ebd7;
}

.cozy-theme #sudoku-main-wrapper {
  background-color: #f8ebd7;
}

.cozy-theme main {
  background-color: #f8ebd7;
}

.cozy-theme .tile {
  background-color: #e07a50;
  border: 2px solid #7f4832;
}

.cozy-theme .tile::after {
  background-color: #bb603f;
  border-top: 1px solid #bb603f
}

.cozy-theme .tile-corner-number {
  color: #f9f0df;
}

.cozy-theme .tile__letter {
  color: #f9f0df;
}

.cozy-theme .sudoku-action-section .tile {
  background-color: #f8ebd8;
}

.cozy-theme .sudoku-action-section .tile::after {
  background-color: #c4af98;
  border-top: 1px solid #c4af98;
}

.cozy-theme .sudoku-board {
  background-color: #9e6847;
}

.cozy-theme .sudoku-board-outline {
  background-color: #9e6847;
  outline: 5px solid #9e6847
}

.cozy-theme .sudoku-cell.pre-filled {
  background-color: #dfc3a2;
}

.cozy-theme .sudoku-cell {
  background-color: #f8ebd7;
  outline: 1px solid #9e6847;
}


.cozy-theme .sudoku-cell.highlight-row {
  background-color: #c4af98 !important;
}

.cozy-theme .sudoku-cell.highlight-col {
  background-color: #c4af98 !important;
}

.cozy-theme .sudoku-cell.selected {
  background-color: #e07a50 !important;
}

.cozy-theme .sudoku-cell.highlight-same-number {
  background-color: #e07a50 !important;
}

.cozy-theme .sudoku-keyboard.candidate-mode .tile {
  background-color: #c4af98 !important;
}

/* selected highlight-row highlight-col */


/* other added */

h2 {
  width: 100%;
}

.green-box,
.red-box {
  display: inline-block;
  width: 1.5em;
  height: 1.1em;
  vertical-align: middle;
  margin: 0 0.2em;
  border-radius: 4px;
}

.green-box {
  background: #3ec46d;
}

.red-box {
  background: #e74c3c;
}

/* this is for the sidebars for the mediavine ads */
.sudoku-layout-flex {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
}

.sudoku-sidebar {
  width: 350px;
  font-size: 1em;
  color: #444;
  flex-shrink: 0;
}

.sudoku-content-wrapper {
  flex: 1 1 0%;
  max-width: 800px;
  /* margin: 0 2em; */
}

@media (max-width: 900px) {
  .sudoku-sidebar {
    display: none !important;
  }

  .sudoku-layout-flex {
    display: block !important;
  }
}