/* === General Layout === */
.appContainer {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 1rem 1rem 4rem 1rem;
  box-sizing: border-box;
}

/* === New Header Styles === */
.gameHeader {
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
  background-color: var(--bg-sec);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(var(--shadow-rgb), 0.1);
  box-sizing: border-box;
  margin-bottom: 2rem;
}

.topBar,
.controlsBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 1rem;
}

.navSection {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.navCenter {
  justify-content: center;
  flex-grow: 1;
}
.navRight {
  justify-content: flex-end;
}
.navbarTitle {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--txt);
  margin: 0;
}

.iconButton {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background-color: var(--bg-ter);
  border: none;
  border-radius: var(--radius);
  color: var(--txt);
  cursor: pointer;
  transition: filter 0.2s ease;
}
.iconButton:hover {
  filter: brightness(1.1);
}
.iconButton svg {
  width: 24px;
  height: 24px;
}

.gameStats {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-weight: 600;
  color: var(--txt-dim);
  background-color: var(--bg-primary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
}

.difficultyControl {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--txt-dim);
  font-weight: 600;
}
.segmentedControl {
  display: flex;
  background-color: var(--bg-ter);
  border-radius: var(--radius);
  padding: 4px;
}
.segmentedControl button:hover {
  background-color: var(--bg-primary);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.segmentedControl button {
  background-color: transparent;
  border: none;
  padding: 0.5rem 1rem;
  color: var(--txt-dim);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.segmentedControl button.active {
  background-color: var(--bg-sec);
  color: var(--txt);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.howToPlayBtn {
  background-color: var(--bg-ter);
  color: var(--txt-dim);
  border: 1px solid transparent;
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  transition: all 0.2s ease;
}
.howToPlayBtn:hover {
  filter: brightness(1.1);
  border-color: var(--txt-dim);
}

/* === Game Container === */
.gameWrapper {
  width: 100%;
  max-width: 900px;
  background-color: var(--bg-sec);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(var(--shadow-rgb), 0.15);
  padding: 1.5rem;
  box-sizing: border-box;
}

/* === New Action Button Styles === */
.gameActions {
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}
.btn {
  padding: 0.8rem 1.2rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    transform 0.2s ease,
    filter 0.2s ease;
  border: 2px solid transparent;
}
.btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}
.btn:disabled {
  background-color: var(--bg-ter) !important;
  color: var(--txt-disabled) !important;
  border-color: var(--bg-ter) !important;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

.btnPrimary {
  background-color: var(--btn);
  color: white;
  border-color: var(--btn);
}

.btnSecondary {
  background-color: var(--bg-ter);
  color: var(--txt);
  border-color: var(--bg-ter);
}
.btnSecondary:hover {
  border-color: var(--btn);
}

/* === Status & Modal (unchanged) === */
.statusMessage {
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-weight: 600;
  grid-column: 1/-1;
  text-align: center;
}
.statusComplete {
  background-color: rgba(var(--shadow-rgb), 0.1);
  color: var(--btn);
}
.statusConflict {
  background-color: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}
.statusCorrect {
  background-color: rgba(var(--shadow-rgb), 0.2);
  color: var(--btn);
}
.modalBackdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}
.modalContent {
  background-color: var(--bg-sec);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  position: relative;
  border: 1px solid var(--txt-dim);
}
.modalCloseBtn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  padding: 0.4rem 0.8rem;
  background-color: var(--txt-dim);
  color: var(--bg-primary);
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
.modalCloseBtn:hover {
  filter: brightness(1.1);
}
.modalTitle {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 0;
  margin-bottom: 1rem;
  color: var(--txt-dim);
}
.modalContent ul {
  list-style-type: disc;
  padding-left: 1.5rem;
  color: var(--txt-dim);
}
.modalContent ul li {
  margin-bottom: 0.5rem;
}

/* === GLOBAL STYLES for Board/Cell === */
:global(.sudoku-wrap) {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

:global(.sudoku-board) {
  display: grid;
  grid-template-rows: repeat(9, 1fr);
  border: 3px solid var(--txt-dim); /* Outer thick border */
  border-radius: calc(var(--radius) + 4px);
  overflow: hidden;
}

:global(.sudoku-row) {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
}

:global(.sudoku-cell) {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: clamp(1rem, 5vw, 1.5rem);
  background: var(--bg-sec);
  border: 1px solid var(--bg-ter); /* Inner thin border */
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
  cursor: pointer;
  color: var(--btn-hover);
}

/* Thicker borders for 3x3 blocks */
:global(.sudoku-cell:nth-child(3n)) {
  border-right: 3px solid var(--txt-dim);
}
:global(.sudoku-row:nth-child(3n) .sudoku-cell) {
  border-bottom: 3px solid var(--txt-dim);
}

:global(.sudoku-cell.is-fixed) {
  color: var(--txt);
  font-weight: 700;
  cursor: default;
}

:global(.sudoku-cell.is-related:not(.is-selected)) {
  background: var(--bg-ter);
}

:global(.sudoku-cell.is-selected) {
  background-color: var(--btn);
  color: white;
}

/* Optional: hover effect for editable cells */
:global(.sudoku-cell:not(.is-fixed):hover) {
  background-color: var(--btn-light);
  color: var(--btn);
}
