:root {
  --paper: #f3f1e9; --ink: #26312b; --muted: #697169; --line: #d5d8cc; --orange: #b84f2b;
  --board: #252f2b; --mint: #d2e4b7; --focus: #eaa273; --hot: #f08a5d;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink); background: var(--paper); font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea { font: inherit; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-underline-offset: 4px; }
button { cursor: pointer; border: 1px solid var(--line); color: var(--ink); background: transparent; border-radius: 6px; padding: 10px 13px; font-size: 13px; line-height: 1.4; min-height: 42px; }
button:hover { background: #e6e8dc; }
button:disabled { cursor: default; opacity: .42; }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--orange); outline-offset: 4px; }
[hidden] { display: none !important; }
.site-header, main, footer { width: min(1060px, calc(100% - 64px)); margin: 0 auto; }
.site-header { height: 84px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.wordmark { font-size: 19px; font-weight: 650; letter-spacing: -.7px; text-decoration: none; display: flex; align-items: center; gap: 5px; }
.wordmark span { font-weight: 400; }
.wordmark i { width: 7px; height: 7px; background: var(--orange); border-radius: 50%; margin: 4px 0 0 5px; }
.source-link { font-size: 12px; text-decoration: none; color: var(--muted); }
.eyebrow { font-size: 10px; letter-spacing: 1.7px; font-weight: 700; color: var(--muted); margin: 0 0 16px; }

.intro { padding: 40px 0 30px; display: grid; grid-template-columns: 1fr 370px; align-items: end; gap: 0 30px; }
.intro .eyebrow { grid-column: 1 / -1; }
h1 { font-size: clamp(36px, 4.9vw, 58px); line-height: 1.03; letter-spacing: -2.8px; font-weight: 580; margin: 0; }
h1 span { color: var(--orange); }
.lede { font-size: 15px; line-height: 1.7; margin: 0 0 2px; color: #626b60; }

.levels { display: flex; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 28px; }
.level { flex: 1; text-align: left; border: 0; border-radius: 0; padding: 15px 12px; display: flex; align-items: center; gap: 12px; position: relative; }
.level:first-child { padding-left: 0; }
.level b { font-size: 12px; font-weight: 500; color: var(--muted); }
.level span { display: block; font-size: 13px; }
.level small { display: block; font-size: 10px; color: var(--muted); margin-top: 3px; }
.level[aria-current=true]:after { content: ""; height: 3px; background: var(--orange); position: absolute; bottom: -1px; left: 0; right: 12px; }
.level[aria-current=true] b { color: var(--orange); }

.playground { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: 46px; align-items: start; }
.board-column { background: var(--board); border-radius: 12px; color: #f3f1e9; overflow: hidden; position: sticky; top: 14px; }
.board-top { padding: 18px 22px 4px; display: flex; gap: 10px; justify-content: space-between; align-items: center; font-size: 12px; }
.switch { font-size: 11px; color: #c9d0c0; display: flex; align-items: center; gap: 7px; cursor: pointer; }
.switch input { width: 15px; height: 15px; margin: 0; accent-color: var(--mint); }
.board { position: relative; width: 100%; max-width: 470px; margin: 0 auto; }
.board svg { position: absolute; inset: 0; width: 100%; height: 100%; }
#grid-points { position: absolute; inset: 0; }
.grid-line { stroke: #4c5a50; stroke-width: .7; opacity: .55; }
.axis-label { font-size: 10px; fill: #a2ad9e; text-anchor: middle; font-variant-numeric: tabular-nums; }
.pair-line { stroke: var(--focus); stroke-width: 2.3; opacity: .85; stroke-linecap: round; }
.flash-line { stroke-linecap: round; animation: flash 1.3s ease-out forwards; }
.flash-line.reused { stroke: var(--mint); stroke-width: 1.4; }
.flash-line.fresh { stroke: var(--hot); stroke-width: 2.6; }
@keyframes flash { 0% { opacity: 0; } 12% { opacity: .95; } 60% { opacity: .7; } 100% { opacity: 0; } }

.point { position: absolute; transform: translate(-50%, -50%); width: 44px; height: 44px; min-height: 0; padding: 0; background: transparent !important; border: 0; border-radius: 50%; display: grid; place-items: center; touch-action: manipulation; color: #9eaa9c; font-size: 10px; font-variant-numeric: tabular-nums; }
.board.dense .point { width: 36px; height: 36px; }
.point:before { content: ""; width: 8px; height: 8px; background: #738075; border-radius: 50%; transition: width .12s, height .12s, background .12s; grid-area: 1 / 1; }
.point:hover:before { background: #c1c8b7; width: 11px; height: 11px; }
.point[aria-pressed=true]:before { background: var(--mint); width: 15px; height: 15px; box-shadow: 0 0 0 5px #d2e4b713; }
.point.in-pair[aria-pressed=true]:before { background: var(--focus); }
.point.pop:before { animation: pop .28s ease-out; }
@keyframes pop { 0% { transform: scale(.3); } 70% { transform: scale(1.35); } 100% { transform: scale(1); } }
.point:focus-visible { outline: 2px solid var(--focus); outline-offset: -4px; }
/* Move costs: the dot becomes a small number. */
.point[data-cost]:before { width: 19px; height: 19px; background: #323d37; }
.point[data-cost]:after { content: "+" attr(data-cost); grid-area: 1 / 1; position: relative; font-size: 9.5px; color: #aab4a5; }
.point[data-cost="0"]:before { background: #44543f; box-shadow: 0 0 0 1px #7f9a6a inset; }
.point[data-cost="0"]:after { content: "0"; color: var(--mint); font-weight: 650; }
.point[data-cost]:hover:before { background: #52604f; width: 22px; height: 22px; }
.point[data-heat="2"]:after { color: #d9b08f; }
.point[data-heat="3"]:after { color: var(--hot); }

.board-bottom { padding: 10px 22px 17px; border-top: 1px solid #465047; display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.board-bottom p { font-size: 10.5px; line-height: 1.6; color: #d6dacd; margin: 0; }
.board-bottom p span { color: #9eaa9c; }
.board-actions { display: flex; gap: 6px; }
.quiet { border-color: #536052; color: #e5e6d9; padding: 7px 8px; min-height: 34px; font-size: 11px; white-space: nowrap; }
.quiet:hover { background: #3d483c; }

.challenge-heading .eyebrow { margin: 4px 0 10px; }
.challenge-heading h2 { font-size: 25px; letter-spacing: -.7px; margin: 0 0 9px; font-weight: 550; }
.challenge-heading p:not(.eyebrow) { font-size: 13px; line-height: 1.6; color: var(--muted); margin: 0; }
.size-picker { display: flex; gap: 6px; margin-top: 12px; }
.size-picker button, .stretch-picker button { min-height: 34px; padding: 6px 12px; font-size: 12px; }
.size-picker button[aria-pressed=true], .stretch-picker button[aria-pressed=true] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.scores { display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 18px; padding: 20px 0 17px; }
.scores > div + div { border-left: 1px solid var(--line); padding-left: 18px; }
.score { font-size: 48px; letter-spacing: -3px; line-height: 1.05; display: block; font-variant-numeric: tabular-nums; }
.score span { font-size: 18px; color: #8b9384; letter-spacing: -1px; margin-left: 6px; }
.score.accent { color: var(--orange); }
.score.level-with-par { color: #55793a; }
#par-count { color: #8b9384; }
.score-label { display: block; font-size: 11px; color: var(--muted); margin-top: 7px; line-height: 1.35; }
.status { font-size: 12.5px; line-height: 1.6; padding: 12px 14px; border: 1px solid var(--line); border-radius: 6px; min-height: 64px; background: #e9ecdf; }
.status.success { border-color: #8b9f6f; background: #dfe9cf; }
.status strong { font-weight: 650; }
.win-actions { display: flex; gap: 7px; margin-top: 10px; flex-wrap: wrap; }
.win-actions button { flex: 1; white-space: nowrap; }
.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.primary:hover { background: #3d493b; }

.distance-panel { padding-top: 22px; }
.section-label { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.section-label h3 { font-size: 13px; font-weight: 600; margin: 0; }
.section-label span { font-size: 10px; color: var(--muted); }
.micro { font-size: 10.5px; color: var(--muted); line-height: 1.5; margin: 8px 0 12px; }
.distance-chips { display: flex; flex-wrap: wrap; gap: 5px; min-height: 66px; align-items: flex-end; }
.distance-chip { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; min-width: 30px; min-height: 0; padding: 4px 4px 5px; font-size: 11px; font-variant-numeric: tabular-nums; background: transparent; border-color: transparent; }
.distance-chip i { display: block; width: 18px; background: #b9c4a6; border-radius: 3px 3px 0 0; transition: height .2s; }
.distance-chip.fresh i { background: var(--orange); }
.distance-chip[aria-pressed=true], .distance-chip:hover, .distance-chip:focus-visible { background: #e3e6d8; }
.distance-chip[aria-pressed=true] i { background: var(--ink); }
.distance-detail { min-height: 28px; font-size: 10.5px; line-height: 1.5; color: var(--muted); margin: 8px 0 14px; }

.machines { border-top: 1px solid var(--line); padding: 16px 0 6px; }
.machines table { width: 100%; border-collapse: collapse; font-size: 12px; margin: 10px 0 12px; font-variant-numeric: tabular-nums; }
.machines td { padding: 6px 0; border-bottom: 1px solid #e2e4d9; }
.machines td:last-child { text-align: right; color: var(--muted); }
.machines td b { font-weight: 650; color: var(--ink); }
.machines tr.you td { border-bottom: 0; }
.machines tr.you b { color: var(--orange); }
#bot { font-size: 12px; min-height: 36px; padding: 8px 12px; }
#bot-message { min-height: 16px; margin: 8px 0 4px; }
.hint { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 12px; }
.hint summary { padding: 12px 0; }
.hint p { font-size: 12px; line-height: 1.6; color: var(--muted); margin: 0 0 13px; }
.tools { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 15px; }
.tools button { font-size: 11px; min-height: 36px; padding: 8px 10px; }
.action-message { font-size: 11px; color: var(--orange); line-height: 1.5; min-height: 17px; margin: 10px 0 0; }

.why { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 46px; margin-top: 54px; padding-top: 38px; border-top: 1px solid var(--line); align-items: start; }
.why h2 { font-size: 30px; letter-spacing: -1.2px; font-weight: 570; margin: 0 0 16px; }
.why-copy p:not(.eyebrow) { font-size: 14px; line-height: 1.75; color: #56604f; margin: 0 0 13px; max-width: 480px; }
.why-copy strong { color: var(--ink); font-weight: 600; }
.why-demo { background: #eae9df; border-radius: 12px; padding: 18px 20px 20px; }
.stretch-picker { display: flex; gap: 6px; flex-wrap: wrap; }
#stretch-board { display: block; width: 100%; max-width: 300px; height: 330px; margin: 14px auto 8px; }
#stretch-board circle { fill: #9aa392; }
#stretch-board circle.bad { fill: var(--orange); }
#stretch-board line { stroke: var(--orange); stroke-width: 2; stroke-linecap: round; }
#stretch-board line.second { stroke: var(--ink); stroke-dasharray: 4 4; }
.stretch-result { font-size: 13px; line-height: 1.6; min-height: 62px; margin: 0 0 10px; }
.stretch-result strong { font-weight: 650; }
#stretch-next { font-size: 12px; min-height: 34px; padding: 6px 12px; }

.under-the-hood { border-top: 1px solid var(--line); margin: 42px 0 0; }
.under-the-hood details { border-bottom: 1px solid var(--line); }
summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
summary::-webkit-details-marker { display: none; }
summary:after { content: "+"; font-size: 18px; font-weight: 400; color: var(--muted); }
details[open] > summary:after { content: "−"; }
.under-the-hood summary { font-size: 13px; padding: 20px 0; }
.detail-copy { max-width: 760px; padding-bottom: 14px; font-size: 13px; line-height: 1.8; color: #56604f; }
.detail-copy p:first-child { margin-top: 0; }
.detail-copy strong { color: var(--ink); font-weight: 600; }
.detail-copy pre { overflow: auto; padding: 12px 16px; background: #e7e9dd; border-radius: 6px; font-size: 12px; }
textarea, input[type=text] { width: 100%; padding: 10px; color: var(--ink); background: #f9f8f2; border: 1px solid #b9c1af; border-radius: 5px; margin: 8px 0; resize: vertical; }
textarea { font-family: ui-monospace, monospace; font-size: 12px; }
#input-error { color: var(--orange); }
#share-fallback label { font-size: 12px; }
footer { display: flex; justify-content: space-between; gap: 20px; font-size: 10px; color: var(--muted); padding: 26px 0 35px; }

@media (max-width: 820px) {
  .site-header, main, footer { width: calc(100% - 32px); }
  .site-header { height: 62px; }
  .intro { grid-template-columns: 1fr; padding: 24px 0 20px; gap: 14px; }
  .intro .eyebrow { margin: 0; }
  .intro h1 { font-size: 40px; letter-spacing: -2px; }
  .lede { font-size: 13.5px; line-height: 1.6; }
  .levels { margin-bottom: 18px; overflow-x: auto; }
  .level { padding: 11px 8px; gap: 6px; align-items: flex-start; min-width: 74px; }
  .level b { font-size: 10px; margin-top: 1px; }
  .level span { font-size: 10.5px; line-height: 1.3; }
  .level small { font-size: 9px; }
  .playground { grid-template-columns: 1fr; gap: 14px; }
  .score-column { display: contents; }
  .challenge-heading { order: 1; }
  .challenge-heading h2 { font-size: 21px; margin-bottom: 5px; }
  .challenge-heading .eyebrow { display: none; }
  .board-column { order: 2; position: static; }
  .scores { order: 3; padding: 0; gap: 12px; }
  .score { font-size: 36px; letter-spacing: -2px; }
  .score span { font-size: 15px; }
  .scores > div + div { padding-left: 12px; }
  .status { order: 4; min-height: 0; }
  .win-actions { order: 5; margin-top: 0; }
  .distance-panel { order: 6; padding-top: 4px; }
  .machines { order: 7; }
  .hint { order: 8; }
  .tools { order: 9; margin-top: 0; }
  .action-message { order: 10; margin: 0; }
  #share-fallback { order: 11; }
  .board-top { padding: 14px 16px 0; }
  .board-bottom { padding: 9px 16px 13px; }
  #cost-help { display: none; }
  .why { grid-template-columns: 1fr; gap: 20px; margin-top: 34px; padding-top: 28px; }
  .why h2 { font-size: 25px; }
  .under-the-hood { margin-top: 28px; }
  footer { font-size: 9px; line-height: 1.5; }
  .source-link { font-size: 10px; }
  .wordmark { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
