.squares-hero { display: grid; grid-template-columns: 1.5fr 1fr; align-items: center; gap: 60px; padding-block: 64px; border-bottom: var(--line); }
.squares-hero h1 { font-size: clamp(3.3rem, 6.5vw, 6.5rem); line-height: .95; }
.squares-hero h1 em { text-transform: none; }
.squares-hero-copy { position: relative; padding: 20px 0 0 28px; border-left: 3px solid var(--blue); }
.squares-hero-copy p { font-size: 1rem; line-height: 1.75; max-width: 370px; margin: 16px 0; }
.squares-stamp { display: grid; place-items: center; width: 72px; height: 72px; border: var(--line); background: #e5dcf4; box-shadow: 5px 5px 0 var(--ink); font-family: Georgia, serif; font-size: 2.5rem; font-style: italic; }
.squares-jump { color: var(--blue); font-size: .82rem; font-weight: 800; text-decoration: underline; text-underline-offset: 4px; }
.square-lab { padding-block: 52px; border-bottom: var(--line); scroll-margin-top: 24px; }
.squares-section-heading { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-bottom: 32px; }
.squares-page h2 { font-size: clamp(2.5rem, 4.2vw, 4.2rem); line-height: 1; }
.squares-section-heading > p { max-width: 300px; font-size: .86rem; line-height: 1.7; }
.square-playground { display: grid; grid-template-columns: .85fr 1.4fr; gap: 28px; align-items: start; }
.square-controls { border: var(--line); padding: 28px; background: var(--white); }
.square-controls fieldset { min-width: 0; border: 0; padding: 0; margin: 0; }
.square-number-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.square-number-heading label { font-weight: 900; font-size: 1.1rem; letter-spacing: -.035em; }
.square-number-heading label span { display: block; margin-top: 4px; font-size: .76rem; font-weight: 400; letter-spacing: 0; }
#square-n { width: 80px; min-height: 52px; padding: 8px; border: var(--line); border-radius: 0; background: var(--paper); color: var(--ink); font-size: 1.25rem; font-weight: 800; }
#square-n[aria-invalid="true"] { border-color: #9c2e20; }
#square-range { width: 100%; display: block; min-height: 40px; margin: 14px 0 0; accent-color: var(--blue); cursor: pointer; }
.square-field-help { margin: 0; font-size: .75rem; line-height: 1.6; }
.square-error { margin: 8px 0 0; font-size: .78rem; color: #9c2e20; font-weight: 700; }
.square-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; border-top: 1px solid #c8c3b9; border-bottom: 1px solid #c8c3b9; margin: 24px 0; padding: 20px 0; }
.square-stats span, .square-stats small { display: block; font-size: .7rem; }
.square-stats strong { display: block; font-size: 3.1rem; letter-spacing: -.07em; line-height: 1.2; }
.square-stats > div:last-child strong { color: #593779; }
.square-step-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.square-step-controls button { display: flex; align-items: center; gap: 10px; min-height: 54px; text-align: left; background: var(--paper); border: var(--line); padding: 8px 10px; color: var(--ink); font: inherit; font-size: .72rem; font-weight: 800; cursor: pointer; }
.square-step-controls button > span:first-child { font-size: 1.5rem; font-weight: 400; }
.square-play-controls { display: flex; flex-direction: column; align-items: stretch; gap: 14px; margin: 20px 0 0; }
.square-play-controls .button { justify-content: space-between; background: #e5dcf4; cursor: pointer; padding-inline: 16px; gap: 12px; }
#reset-square { min-height: 36px; align-self: start; padding: 0; border: 0; background: none; font: inherit; font-size: .77rem; font-weight: 800; color: var(--blue); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.square-play-note { margin: 8px 0 20px; min-height: 2.7em; font-size: .76rem; line-height: 1.6; }
.square-presets { border-top: 1px solid #c8c3b9; padding-top: 18px; }
.square-presets > span { font-size: .75rem; font-weight: 800; }
.square-presets > div { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.square-presets button { min-height: 44px; padding: 6px 0; border: 1px solid var(--ink); background: var(--white); color: var(--ink); font: inherit; font-size: .72rem; font-weight: 800; cursor: pointer; }
.square-presets button[aria-pressed="true"] { background: var(--yellow); }
.square-stage { min-width: 0; border: var(--line); background: var(--white); padding: 22px 24px 24px; }
.square-stage-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.square-stage-heading h3 { margin: 0; font-size: 1.1rem; letter-spacing: -.03em; }
.square-unit { display: inline-flex; align-items: center; gap: 6px; font-size: .72rem; white-space: nowrap; }
.square-unit i { display: inline-block; width: 13px; height: 13px; background: var(--yellow); border: 1px solid var(--ink); }
#square-visual { display: block; width: 100%; margin-block: 12px 0; }
.square-tile { stroke: var(--ink); stroke-width: .8; }
.tone-0 { fill: #f4c941; --tile-color: #f4c941; }
.tone-1 { fill: #f4b5a2; --tile-color: #f4b5a2; }
.tone-2 { fill: #a9c5e9; --tile-color: #a9c5e9; }
.tone-3 { fill: #acd0b0; --tile-color: #acd0b0; }
.tone-4 { fill: #c4afe5; --tile-color: #c4afe5; }
.tone-5 { fill: #8fcfcd; --tile-color: #8fcfcd; }
.square-tile.is-spotlight { stroke-width: 2; }
#square-visual.is-isolated .square-tile:not(.is-spotlight) { fill: #f2eee6; stroke: #aaa397; stroke-width: .6; }
.square-guide { stroke: #55554c; stroke-width: 1.2; fill: none; }
.square-dimension { font: 14px "Trebuchet MS", sans-serif; fill: var(--ink); }
.square-spotlight { border-top: 1px solid #c8c3b9; padding-top: 18px; }
.square-spotlight-label { margin: 0 0 8px; font-size: .72rem; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; color: #593779; }
#layer-count { margin: 0 0 8px; font-weight: 800; font-size: .95rem; line-height: 1.6; }
#layer-growth { margin: 0; font-size: .82rem; line-height: 1.6; }
#focus-layer { min-height: 44px; margin-top: 12px; padding: 0; border: 0; background: none; font: inherit; font-size: .77rem; font-weight: 800; text-decoration: underline; text-underline-offset: 4px; color: var(--blue); cursor: pointer; }
.square-equation-card { margin-top: 28px; padding: 24px 28px; background: #e5dcf4; border: var(--line); }
.square-equation-heading { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.square-equation-heading h3 { margin: 0; font-size: 1rem; letter-spacing: -.025em; }
.square-equation-heading p { margin: 0; max-width: 270px; font-size: .75rem; line-height: 1.6; }
.square-equation { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 18px; }
#odd-terms { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 9px; padding: 0; margin: 0; }
#odd-terms li { display: flex; align-items: center; gap: 9px; }
.odd-term { min-width: 44px; min-height: 44px; border: 1px solid var(--ink); background: var(--tile-color); color: var(--ink); font: inherit; font-size: 1rem; font-weight: 800; cursor: pointer; }
.odd-term[aria-pressed="true"] { border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.square-answer { margin: 0; font-size: 1.6rem; font-weight: 900; letter-spacing: -.04em; }
.square-status { margin: 18px 0 0; min-height: 1.5em; font-size: .8rem; line-height: 1.65; }
.square-proof { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; padding-block: 58px; border-bottom: var(--line); }
.square-proof > div > p { font-size: .95rem; line-height: 1.8; max-width: 520px; }
.square-proof-card { padding: 28px; background: #f9dd73; border: var(--line); }
.square-proof-card .eyebrow { font-size: .63rem; line-height: 1.6; }
.square-proof-sum { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 12px; align-items: center; margin: 28px 0; }
.square-proof-sum > span { font-size: 2.8rem; font-weight: 900; letter-spacing: -.06em; text-align: center; line-height: 1.2; }
.square-proof-sum small { display: block; font-size: .63rem; font-weight: 400; letter-spacing: 0; margin-top: 8px; }
.square-proof-card .square-formula { border-top: 1px solid var(--ink); padding-top: 20px; font-size: 1.1rem; font-weight: 800; overflow-wrap: anywhere; }
.square-proof-card .square-formula-note { font-size: .78rem; }
.square-discover { padding-block: 58px; }
.square-challenges { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.square-challenges article { padding: 24px; border: var(--line); background: var(--white); }
.square-challenges article > span { font-size: .65rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.square-challenges h3 { margin: 18px 0 10px; font-size: 1.3rem; letter-spacing: -.04em; }
.square-challenges p { font-size: .86rem; line-height: 1.7; }
.square-challenges button { min-height: 44px; padding: 0; border: 0; background: none; color: var(--blue); font: inherit; font-size: .8rem; font-weight: 800; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.squares-page button:disabled { cursor: default; opacity: .5; box-shadow: none; }
.squares-page :is(button, input, a):focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
@media (max-width: 1050px) {
  .squares-hero { gap: 32px; grid-template-columns: 1.4fr 1fr; }
  .squares-hero h1 { font-size: clamp(3rem, 6vw, 5rem); }
  .square-controls { padding: 22px; }
  .square-playground { gap: 20px; grid-template-columns: 1fr 1.25fr; }
  .square-step-controls { grid-template-columns: 1fr; }
  .square-presets > div { grid-template-columns: 1fr 1fr; }
  .square-proof { gap: 28px; }
  .square-proof-sum { gap: 8px; }
  .square-proof-sum > span { font-size: 2.3rem; }
}
@media (max-width: 760px) {
  .squares-hero { grid-template-columns: 1fr; padding-block: 40px; }
  .squares-hero h1 { font-size: clamp(3rem, 10.6vw, 5rem); }
  .squares-hero-copy { padding-top: 0; }
  .squares-stamp { float: right; width: 56px; height: 56px; font-size: 2rem; margin: 0 6px 12px 18px; }
  .squares-hero-copy p { max-width: none; margin-top: 0; }
  .square-lab { padding-block: 40px; }
  .squares-section-heading, .square-equation-heading { display: block; }
  .squares-section-heading > p, .square-equation-heading > p { margin-top: 20px; max-width: none; }
  .square-playground, .square-proof { grid-template-columns: 1fr; }
  .square-step-controls { grid-template-columns: 1fr 1fr; }
  .square-presets > div { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .square-stage { padding: 20px 16px; }
  .square-stage-heading h3 { font-size: 1rem; }
  .square-equation-card { padding: 22px 20px; }
  .square-answer { font-size: 1.4rem; }
  .square-proof, .square-discover { padding-block: 40px; }
  .square-challenges { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
  .square-controls { padding: 18px; }
  .square-step-controls { grid-template-columns: 1fr; }
  .square-stage-heading { align-items: start; }
  .square-unit { font-size: .65rem; }
  .square-proof-card { padding: 20px; }
  .square-proof-sum { gap: 6px; }
  .square-proof-sum > span { font-size: 2rem; }
}
