/* Shared chess diagrams keep the same pieces and rules across the guide, puzzles and answers. */
.chess-board { width: 100%; aspect-ratio: 1; display: grid; grid-template-rows: repeat(8, minmax(0, 1fr)); border: 1px solid var(--cocoa); }
.chess-row { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); min-height: 0; }
.chess-square { display: grid; place-items: center; position: relative; min-width: 24px; min-height: 24px; width: 100%; height: 100%; padding: 0; border: 0; border-radius: 0; aspect-ratio: 1; color: var(--cocoa); }
button.chess-square { cursor: pointer; }
.square-light { background: #f4e5cd; }
.square-dark { background: #a64b4b; }
.piece-icon { width: 73%; height: 73%; display: block; overflow: visible; flex: none; }
.piece-icon path { stroke-width: 1.4px; stroke-linejoin: round; paint-order: stroke fill; vector-effect: non-scaling-stroke; }
.piece-white path { fill: #fffaf0; stroke: var(--cocoa); }
.piece-dark path { fill: var(--cocoa); stroke: #fff1d8; }
.rank-label, .file-label { position: absolute; font: 700 .7rem/1 'Instrument', sans-serif; pointer-events: none; }
.rank-label { top: 3px; left: 4px; }
.file-label { bottom: 3px; right: 4px; }
.square-dark .rank-label, .square-dark .file-label { color: #fffaf0; }
.square-selected { box-shadow: inset 0 0 0 4px var(--focus); z-index: 1; }
.chess-square:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; z-index: 2; box-shadow: inset 0 0 0 6px var(--paper); }
.move-marker { width: 22%; height: 22%; border-radius: 50%; background: var(--focus); position: absolute; pointer-events: none; border: 2px solid #fffaf0; }
.capture-marker { width: 87%; height: 87%; background: transparent; border: 4px solid var(--focus); box-shadow: 0 0 0 2px #fffaf0; }
.board-fallback { grid-row: 1 / -1; padding: 1.5rem; background: var(--cream); color: var(--cocoa); line-height: 1.6; margin: 0; }
.noscript-note { padding: 1rem; border: 1px solid var(--line); line-height: 1.6; }

/* A quiet practice space, in the same visual system as the gift set. */
.puzzle-main, .guide-main { padding-block: 1.5rem 5rem; }
.puzzle-intro { display: flex; justify-content: space-between; align-items: end; gap: 2rem; padding-bottom: 1rem; }
.puzzle-intro h1, .guide-intro h1 { font: 700 clamp(2.5rem, 4.2vw, 3.25rem)/1.06 'Bricolage', sans-serif; letter-spacing: -.035em; margin: .55rem 0 1rem; }
.puzzle-intro p { margin: 0; }
.puzzle-intro .category { display: none; }
.puzzle-intro h1 { margin: 0 0 .5rem; }
.puzzle-intro > div > p:last-child { color: var(--muted); }
.box-answer-link { color: var(--muted); font-size: .9375rem; line-height: 1.65; }
.box-answer-link a, .puzzle-rule-link a { color: var(--cocoa); text-underline-offset: .25em; }
.puzzle-rule-link a { margin-left: .25em; }
.lesson-tabs { display: flex; gap: 1.5rem; border-bottom: 1px solid var(--line); margin: 0 0 1.5rem; }
.lesson-tabs button { position: relative; display: grid; gap: .3rem; text-align: left; min-height: 64px; padding: .5rem 0; min-width: 176px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); font: inherit; cursor: pointer; }
.lesson-tabs button[aria-pressed=true] { color: var(--cocoa); border-bottom-color: var(--cherry); }
.lesson-tabs button:hover { color: var(--cocoa); }
.lesson-tabs span { font-size: .875rem; font-weight: 400; }
.game-layout { display: grid; grid-template-columns: minmax(0, 480px) minmax(0, 1fr); gap: clamp(2.5rem, 6vw, 5.5rem); max-width: 1100px; }
.board-column { min-width: 0; }
.board-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem 1rem; }
.board-heading h2 { font: 700 clamp(1.5rem, 2.4vw, 1.875rem)/1.2 'Bricolage', sans-serif; letter-spacing: -.02em; margin: 0; }
.lesson-kind { color: var(--muted); font-size: .875rem; margin: 0; }
.board-context { display: flex; flex-wrap: wrap; gap: .35rem 1rem; justify-content: space-between; margin: .75rem 0 .75rem; font-size: .875rem; }
.turn-label { font-weight: 700; margin: 0; }
.board-goal { margin: 0; color: var(--muted); }
.board-help { margin: 1rem 0 0; font-size: .9375rem; line-height: 1.5; }
.keyboard-help, .move-history { font-size: .9375rem; color: var(--muted); }
.keyboard-help summary, .move-history summary { padding-block: .75rem; cursor: pointer; min-height: 48px; }
.keyboard-help p, .move-history p { margin: 0 0 1rem; line-height: 1.6; }
.game-panel { padding-top: 2.5rem; min-width: 0; max-width: 440px; }
.panel-label { margin: 0; color: var(--muted); font-size: .875rem; }
.puzzle-feedback-area { border-top: 1px solid var(--line); padding-top: 1rem; }
.game-feedback { margin: .75rem 0 1.5rem; min-height: 4.6em; font-size: 1.1875rem; line-height: 1.55; }
.game-controls { display: grid; grid-template-columns: 1fr 1fr; gap: .625rem; }
.game-controls #hint { grid-column: 1 / -1; }
.game-controls .button { width: 100%; min-width: 0; min-height: 48px; padding-inline: .75rem; border-radius: 6px; }
.puzzle-main .secondary-button { background: transparent; color: var(--cocoa); border: 1px solid var(--line); }
.puzzle-main button:disabled { opacity: .45; cursor: not-allowed; }
.solution-button { font: inherit; background: transparent; color: var(--cocoa); border: 0; min-height: 48px; padding: .75rem 0; margin: .5rem 0; text-decoration: underline; text-underline-offset: .3em; cursor: pointer; }
.puzzle-result { border-top: 1px solid var(--line); margin: 1rem 0 1.5rem; padding-top: 1.5rem; }
.puzzle-result h3 { font: 700 1.5rem/1.2 'Bricolage', sans-serif; margin: 0 0 .75rem; }
.puzzle-result p { color: var(--muted); line-height: 1.6; }
.result-actions { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.result-actions .button { min-height: 48px; }
.reveal-note { font-size: .875rem; color: var(--muted); border-left: 2px solid var(--cherry); padding-left: .75rem; line-height: 1.55; }
.move-history { border-top: 1px solid var(--line); margin-top: .5rem; }
.lesson-note { color: var(--muted); font-size: .875rem; line-height: 1.65; margin-top: 1.25rem; }
.puzzle-rule-link { font-size: .9375rem; line-height: 1.6; margin-top: 1.5rem; }
#promotion-dialog { width: min(520px, calc(100% - 32px)); max-width: none; background: var(--paper); color: var(--cocoa); border: 1px solid var(--line); border-radius: 6px; padding: clamp(1.25rem, 4vw, 2rem); }
#promotion-dialog::backdrop { background: #201713b3; }
#promotion-dialog h2 { font: 700 1.75rem/1.15 'Bricolage', sans-serif; margin-top: 0; }
#promotion-dialog p { line-height: 1.6; }
.promotion-choices { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin: 1.5rem 0 .5rem; }
.promotion-choices button { min-height: 64px; display: flex; align-items: center; gap: .75rem; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; color: var(--cocoa); font: 700 1rem 'Instrument', sans-serif; cursor: pointer; padding: .75rem; }
.promotion-choices button:hover { border-color: var(--cherry); background: var(--cream); }
.promotion-choices .piece-icon { width: 32px; height: 36px; }

/* The playing guide reads as a compact instruction booklet. */
.guide-intro { max-width: 720px; margin-bottom: 2rem; }
.guide-intro > p { line-height: 1.6; margin-bottom: .875rem; }
.guide-intro .category { margin-bottom: .65rem; }
.guide-intro-note { font-size: 1rem; color: var(--muted); max-width: 62ch; }
.setup-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 440px); grid-template-areas: 'title board' 'copy board'; gap: 1.25rem clamp(2rem, 6vw, 5rem); padding-top: 1.5rem; border-top: 1px solid var(--line); align-items: start; }
.setup-layout > h2 { grid-area: title; }
.setup-copy { grid-area: copy; }
.setup-figure { grid-area: board; }
.guide-main figure { margin: 0; min-width: 0; }
.guide-main figcaption { margin-top: .75rem; color: var(--muted); font-size: .875rem; line-height: 1.55; }
.guide-main h2 { font: 700 clamp(1.75rem, 2.8vw, 2.25rem)/1.15 'Bricolage', sans-serif; letter-spacing: -.025em; margin: 0 0 1.5rem; }
.guide-main .setup-layout > h2 { margin-bottom: 0; }
.setup-steps { margin: 0; padding-left: 1.35rem; }
.setup-steps li { padding-left: .4rem; margin-bottom: 1.4rem; }
.setup-steps li::marker { color: var(--cherry); font-weight: 700; }
.setup-steps h3 { margin: 0 0 .35rem; font: 700 1.125rem/1.35 'Instrument', sans-serif; }
.setup-steps p { color: var(--muted); margin: 0; line-height: 1.6; max-width: 56ch; }
.edible-rule { font-size: .875rem; color: var(--muted); margin-top: 1.5rem; line-height: 1.6; }
.movement-section, .rules-section { margin-top: 4rem; padding-top: 2.5rem; border-top: 1px solid var(--line); }
.guide-section-heading h2 { margin-bottom: .6rem; }
.guide-section-heading > p { color: var(--muted); margin: 0; }
.movement-choices { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .65rem; margin: 1.75rem 0 2rem; }
.movement-choices button { display: flex; align-items: center; justify-content: center; gap: .55rem; flex-wrap: wrap; position: relative; min-height: 84px; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--cocoa); padding: .65rem .4rem 1.4rem; font: 700 1rem 'Instrument', sans-serif; cursor: pointer; }
.movement-choices button[aria-pressed=true] { border-color: var(--cherry); box-shadow: inset 0 -3px var(--cherry); background: var(--cream); }
.movement-choices button:hover { border-color: var(--cherry); }
.movement-choices .piece-icon { width: 26px; height: 32px; }
.selection-label { position: absolute; bottom: 5px; font-size: .875rem; font-weight: 400; }
.movement-layout { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: clamp(2rem, 6vw, 5rem); align-items: center; }
.movement-copy { max-width: 550px; }
.movement-copy h3 { font: 700 1.75rem/1.2 'Bricolage', sans-serif; margin: 0 0 .75rem; }
.movement-copy p { line-height: 1.65; }
.movement-key { display: grid; gap: .6rem; font-size: .9375rem; margin-block: 1.5rem; }
.movement-key > span { display: flex; align-items: center; gap: .6rem; }
.legend-dot, .legend-ring { display: inline-block; flex: none; width: 16px; height: 16px; border-radius: 50%; background: var(--focus); }
.legend-ring { background: transparent; border: 3px solid var(--focus); }
.movement-reminder { color: var(--muted); font-size: .9375rem; }
.all-moves { margin-top: 2rem; }
.guide-main details { border-bottom: 1px solid var(--line); padding-block: .2rem; }
.guide-main details summary { cursor: pointer; min-height: 56px; padding-block: 1rem; font-weight: 700; }
.guide-main details p, .guide-main details dl { max-width: 76ch; line-height: 1.7; padding-bottom: .75rem; margin-top: 0; }
.all-moves dt { font-weight: 700; margin-top: 1rem; }
.all-moves dd { margin: .3rem 0 1rem; color: var(--muted); }
.check-rules { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem; margin-bottom: 2rem; }
.check-rules h3 { font: 700 1.25rem/1.2 'Bricolage', sans-serif; margin: 0 0 .65rem; }
.check-rules p { line-height: 1.65; color: var(--muted); margin: 0; }
.special-rules-title { font: 700 1.25rem/1.2 'Bricolage', sans-serif; margin: 2.5rem 0 .75rem; }
.guide-next { display: flex; align-items: center; gap: 1rem 2rem; flex-wrap: wrap; margin-top: 3rem; }
.guide-next p { color: var(--muted); margin: 0; }

@media (max-width: 960px) {
  .game-layout { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 2rem; }
  .setup-layout, .movement-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem; }
  .movement-choices { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .puzzle-main, .guide-main { padding-block: 2rem 3rem; }
  .puzzle-intro { display: block; padding-bottom: 1.5rem; }
  .puzzle-intro .category { display: block; margin-bottom: .65rem; }
  .puzzle-intro h1, .guide-intro h1 { font-size: 2.375rem; }
  .puzzle-intro .box-answer-link { margin-top: 1rem; font-size: .875rem; }
  .box-answer-link br { display: none; }
  .box-answer-link a { margin-left: .25em; }
  .lesson-tabs { gap: 1rem; margin-bottom: 1.75rem; }
  .lesson-tabs button { flex: 1; min-width: 0; font-size: 1rem; }
  .lesson-tabs span { font-size: .875rem; }
  .game-layout { display: flex; flex-direction: column; gap: 1.25rem; }
  .board-column, .game-panel { width: 100%; max-width: 480px; }
  .game-panel { padding-top: 0; }
  .board-context { margin-top: 1rem; }
  .game-feedback { font-size: 1.0625rem; min-height: 3.2em; }
  .game-controls .button { font-size: 1rem; }
  .setup-layout, .movement-layout { grid-template-columns: minmax(0, 1fr); gap: 1.75rem; }
  .guide-intro { margin-bottom: 2rem; }
  .setup-layout { grid-template-areas: 'title' 'board' 'copy'; padding-top: 2rem; }
  .setup-figure, .movement-layout figure { width: 100%; max-width: 440px; }
  .movement-section, .rules-section { margin-top: 3rem; padding-top: 2rem; }
  .movement-choices { gap: .5rem; }
  .movement-choices button { min-height: 86px; font-size: .9375rem; }
  .check-rules { grid-template-columns: 1fr; gap: 1.4rem; }
  .guide-next { display: block; }
  .guide-next .text-button { margin-top: .25rem; }
  .rank-label, .file-label { font-size: .625rem; }
  .square-selected { box-shadow: inset 0 0 0 3px var(--focus); }
  .capture-marker { border-width: 3px; }
}
