.chess-puzzles {
  max-width: 1080px;
  grid-template-columns: minmax(0, 1.3fr) minmax(255px, 1fr);
  grid-template-rows: auto auto auto 1fr;
  grid-template-areas:
    "board prompt"
    "board feedback"
    "board progress"
    "board .";
  gap: 17px clamp(22px, 4vw, 52px);
}
.puzzle-board-area {grid-area: board;}
.puzzle-prompt {grid-area: prompt; min-width: 0;}
.puzzle-feedback {grid-area: feedback; display: grid; gap: 11px; min-width: 0;}
.puzzle-progress {grid-area: progress; min-width: 0; border-top: 1px solid #b5ad8470; padding-top: 13px;}
.puzzle-overline, .puzzle-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 9px;
}
.puzzle-overline, .puzzle-progress-head > span {font-size: .84rem; font-weight: 700; color: var(--chess-muted);}
.puzzle-turn {
  background: #f3e0b4;
  color: #283c31;
  border: 1px solid #f3e0b4;
  border-radius: 24px;
  padding: 3px 10px;
}
.puzzle-turn[data-state="b"] {background: #152b2d; color: #ffebba;}
.puzzle-turn[data-state="solved"] {background: #dfedba; border-color: #dfedba; color: #1b422b;}
.puzzle-prompt h2 {font-size: clamp(1.72rem, 3.2vw, 2.6rem); margin: 10px 0 5px;}
.puzzle-prompt p {color: var(--chess-paper);}
.puzzle-result {
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid #c7b98665;
  border-radius: 8px;
  background: #142c2c92;
  color: var(--chess-muted);
}
.puzzle-explanation {color: var(--chess-paper);}
.puzzle-hint {margin: 0; border-left: 3px solid var(--chess-accent); padding: 4px 0 4px 11px; color: #fff0c7;}
.chess-puzzles .chess-square[data-hint="true"] {outline: 3px dashed #5d3317; outline-offset: -8px;}
.chess-puzzles .chess-square[data-hint="true"]:focus-visible {outline: 3px solid #fff0b0; outline-offset: -5px;}
.chess-puzzles .btn.secondary {border-color: #afbfaa; color: var(--chess-paper); background: #234139;}
.chess-puzzles .btn.secondary:hover:enabled {background: #2e5143;}
.chess-puzzles .btn.primary {border-color: #edd196; background: #f3cd83; color: #1d3429;}
.chess-puzzles .btn.primary:hover:enabled {background: #ffe3a9;}
.puzzle-progress-head h2 {font-size: 1.34rem;}
.puzzle-levels {
  display: grid;
  grid-template-columns: repeat(6,minmax(0,1fr));
  gap: 6px;
  margin: 9px 0 0;
  padding: 0;
  list-style: none;
}
.puzzle-levels button {
  width: 100%;
  min-height: 43px;
  border: 1px solid #c0b78b;
  border-radius: 8px;
  background: #203b32;
  color: #f7e9c5;
  font-weight: 700;
  padding: 3px 0;
  font-variant-numeric: tabular-nums;
}
.puzzle-levels button[data-state="locked"] {border-style: dashed; background: transparent; color: #b1c2af;}
.puzzle-levels button[data-state="solved"] {background: #dbe8bc; color: #203b32;}
.puzzle-levels button[data-state="solved"]::after {content: ' ✓';}
.puzzle-levels button[aria-current="step"] {border-color: #ffcf7e; box-shadow: inset 0 0 0 1px #ffcf7e;}
.puzzle-levels button[aria-current="step"]:not([data-state="solved"]) {background: #f3cd83; color: #242d23;}
.puzzle-reset {margin-top: 8px; padding: 7px 0; border: 0; color: var(--chess-muted); background: transparent; font-size: .83rem; text-decoration: underline;}
.puzzle-reset-dialog p {margin-top: 12px; color: var(--ink);}
.puzzle-reset-dialog .btn.secondary {background: #fff9e7; color: var(--ink); border-color: #8b9e8e;}
.puzzle-reset-dialog .actions {margin-top: 16px;}
@media (max-width: 740px) {
  .chess-puzzles {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    grid-template-areas: "prompt" "board" "feedback" "progress";
    margin-top: 14px;
    gap: 14px;
  }
  .puzzle-prompt h2 {margin-top: 5px;}
}
