:root {
  --paper: #f8f7f5;
  --ink: #181719;
  --wine: #7f1838;
  --wine-dark: #64122b;
  --muted: #67636a;
  --line: #dfdcda;
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 20px; }
body { margin: 0; min-width: 320px; background: var(--paper); color: var(--ink); font: 16px/1.55 var(--sans); }
button, input, select { font: inherit; }
a { color: var(--wine); text-decoration: none; }
a:hover { text-decoration: underline; }
button, a, input, select, summary { touch-action: manipulation; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid rgb(127 24 56 / 18%); outline-offset: 3px; border-color: var(--wine);
}
button { min-height: 44px; padding: 10px 14px; border: 1px solid #cfc9c6; border-radius: 8px; background: white; color: var(--ink); font-weight: 620; cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--wine); color: var(--wine); }
button:disabled { opacity: .48; cursor: not-allowed; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip { position: absolute; top: -100px; left: 16px; padding: 12px; background: white; z-index: 10; }
.skip:focus { top: 8px; }
.header { width: min(calc(100% - 40px),1440px); min-height: 98px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 32px; }
body::before { content: ''; position: absolute; top: 97px; left: 0; right: 0; height: 1px; background: var(--line); }
.brand { display: inline-flex; flex-direction: column; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand strong { font-size: clamp(1.2rem,2vw,1.65rem); letter-spacing: -.025em; }
.brand span { font-size: .94rem; color: var(--muted); }
.header nav { display: flex; align-items: center; gap: clamp(20px,4vw,52px); }
.header nav a { position: relative; color: var(--ink); padding: 36px 0 31px; font-weight: 520; }
.header nav a::after { content: ''; position: absolute; bottom: 17px; left: 0; right: 0; height: 2px; background: var(--wine); transform: scaleX(0); }
.header nav a:hover, .header nav a.active { color: var(--wine); text-decoration: none; }
.header nav a:hover::after, .header nav a.active::after { transform: scaleX(1); }
main { width: min(calc(100% - 40px),1440px); margin: auto; }
h1,h2,h3,p { margin-top: 0; }
#explorer { padding-top: 30px; }
.workspace { display: grid; grid-template-columns: minmax(280px,350px) minmax(0,1fr); gap: 28px; }
.panel { border: 1px solid var(--line); border-radius: 14px; background: white; box-shadow: 0 8px 28px rgb(26 20 22 / 5%); }
.controls { padding: 22px; height: fit-content; }
.panel-heading { margin-bottom: 20px; }
.panel-heading h3 { margin: 0; color: var(--wine-dark); font-size: 1.08rem; letter-spacing: -.01em; }
label { display: block; margin: 16px 0 7px; font-size: .93rem; font-weight: 620; }
select,input[type=number] { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #cfc9c6; border-radius: 8px; background: white; color: var(--ink); }
.check { display: flex; align-items: center; gap: 9px; font-weight: 450; margin: 20px 0; }
input[type=checkbox],input[type=range] { accent-color: var(--wine); }
.field-note { font-size: .8rem; color: var(--muted); margin: 9px 0; }
.primary { width: 100%; background: var(--wine); color: white; border-color: var(--wine); margin: 12px 0 10px; display: flex; align-items: center; justify-content: center; gap: 12px; }
.primary:hover:not(:disabled) { background: var(--wine-dark); color: white; }
.button-pair { display: flex; gap: 9px; }
.button-pair button { flex: 1; font-size: .88rem; }
.control-footer { display: flex; align-items: center; gap: 7px; font-size: .78rem; color: var(--muted); padding-top: 18px; margin-top: 20px; border-top: 1px solid var(--line); }
.dot { height: 6px; width: 6px; border-radius: 50%; background: #648276; }
.experiment { min-width: 0; }
.boards { display: grid; gap: 22px; }
.boards.comparing { grid-template-columns: 1fr 1fr; }
.board-panel { padding: clamp(20px,3vw,32px); min-width: 0; }
.board-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.board-header small { display: block; margin-bottom: 6px; color: var(--wine); font-size: .76rem; font-weight: 760; letter-spacing: .12em; }
.board-header h3 { margin: 0; font: 500 clamp(1.55rem,3vw,2.35rem)/1.2 var(--serif); letter-spacing: -.025em; }
.badge { padding: 7px 13px; border: 1px solid var(--wine); border-radius: 999px; color: var(--wine-dark); font-size: .86rem; font-weight: 650; white-space: nowrap; }
.maze-wrap { background: #fbfaf8; border: 1px solid var(--line); border-radius: 9px; padding: 18px; min-height: 230px; display: flex; align-items: center; justify-content: center; }
.maze-wrap canvas { width: 100%; height: auto; display: block; max-height: 480px; object-fit: contain; }
.board-caption { font-size: .84rem; color: var(--muted); margin: 17px 0 20px; }
.stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; padding-top: 18px; border-top: 1px solid var(--line); }
.stat span { display: block; font-size: .72rem; color: var(--wine-dark); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.stat strong { font-size: 25px; font-weight: 500; }
.stat em { font-size: .75rem; color: var(--muted); font-style: normal; }
.comparing .stats { grid-template-columns: repeat(2,1fr); }
.comparing .board-header { flex-direction: column; gap: 12px; }
.comparing .board-header h3 { font-size: 1.75rem; }
.playback { padding: 20px 22px; margin-top: 22px; }
.playback-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 20px; }
.speed { margin: 0; display: flex; align-items: center; gap: 10px; font-size: .84rem; }
.speed input { width: 90px; }
.speed span { min-width: 20px; }
.timeline { display: flex; justify-content: space-between; gap: 12px; margin-top: 15px; font-size: .78rem; color: var(--muted); }
progress { display: block; width: 100%; height: 5px; margin-top: 10px; accent-color: var(--wine); border: 0; background: #eeece6; }
progress::-webkit-progress-bar { background: #eeece6; }
progress::-webkit-progress-value { background: var(--wine); }
.message { font-size: .85rem; color: var(--muted); margin: 15px 0 0; }
.legend { display: flex; justify-content: center; flex-wrap: wrap; gap: 18px; padding: 25px 0 52px; font-size: .78rem; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 11px; height: 11px; border-radius: 2px; }
.wall { background: #303e39; }.corridor { background: #f0e8d1; border: 1px solid #d4cdbb; }.ivy { background: #bdcfaa; }.griever { background: #d99777; }.explored { background: #c9b6c0; }.route { background: var(--wine); }.key-icon { color: #ad792b; }
.eyebrow { color: var(--wine); font-size: .76rem; font-weight: 760; letter-spacing: .12em; margin: 0 0 6px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 28px; }
.section-heading h2,.about h2,.repository-section h2 { margin: 0; font: 500 clamp(1.55rem,3vw,2.35rem)/1.2 var(--serif); letter-spacing: -.025em; }
.section-heading>p { max-width: 230px; color: var(--muted); font-size: .92rem; margin: 0; }
.learn,.about,.repository-section { padding: clamp(48px,7vw,80px) 0; border-top: 1px solid var(--line); }
.lesson-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 30px; }
.lesson-grid article { border-top: 1px solid var(--line); padding-top: 20px; }
.lesson-number { color: var(--wine); font-size: .8rem; }
.lesson-grid h3 { font: 500 1.4rem var(--serif); margin: 16px 0 12px; }
.lesson-grid p { color: var(--muted); font-size: .94rem; }
.text-button { min-height: 0; padding: 5px 0; border: 0; background: transparent; color: var(--wine); font-size: .87rem; }
.text-button:hover:not(:disabled) { text-decoration: underline; }
.text-button span { margin-left: 8px; }
details { padding: 20px 0; border-top: 1px solid var(--line); margin-top: 35px; }
summary { cursor: pointer; font-size: .94rem; font-weight: 520; }
.algorithm-list { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 35px; padding-top: 24px; }
.algorithm-list p { margin: 0; color: var(--muted); font-size: .9rem; }
.algorithm-list strong { display: block; color: var(--wine); }
.about { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(26px,6vw,72px); }
.about p:not(.eyebrow),.repository-section p:not(.eyebrow) { margin: 22px 0 0; color: var(--muted); font-size: 1.02rem; }
.about-details { padding-top: 35px; }
.about .credit { font-size: .86rem !important; overflow-wrap: anywhere; }
.outline-link { display: inline-block; margin-top: 22px; color: var(--wine); border-bottom: 1px solid var(--wine); font-size: .9rem; }
.repository-section { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; }
.repository-section>div { max-width: 800px; }
.repository-button { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; min-height: 44px; padding: 10px 18px; border: 1px solid var(--wine); border-radius: 8px; font-weight: 620; }
.repository-button:hover { background: var(--wine); color: white; text-decoration: none; }
footer { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 38px 20px; background: #202329; color: white; text-align: center; }
footer span { color: #c4c7cb; font-size: .91rem; }
@media(max-width:1100px) {
  .boards.comparing { grid-template-columns: 1fr; }
  .comparing .stats { grid-template-columns: repeat(4,1fr); }
  .comparing .board-header { flex-direction: row; }
}
@media(max-width:1040px) { .workspace { grid-template-columns: 1fr; }.controls { max-width: none; } }
@media(max-width:760px) {
  .header { width: min(calc(100% - 28px),1440px); min-height: auto; flex-direction: column; align-items: flex-start; padding-top: 20px; gap: 16px; border-bottom: 1px solid var(--line); }
  body::before { display: none; }
  .header nav { width: 100%; overflow-x: auto; gap: 25px; }
  .header nav a { flex: 0 0 auto; padding: 14px 0 18px; font-size: .93rem; }
  .header nav a::after { bottom: 8px; }
  main { width: min(calc(100% - 28px),1440px); }
  #explorer { padding-top: 20px; }
  .board-header,.comparing .board-header { flex-direction: column; gap: 12px; }
  .section-heading { display: block; }.section-heading>p { margin-top: 18px; max-width: none; }
  .lesson-grid,.about,.algorithm-list { grid-template-columns: 1fr; }
  .about-details { padding-top: 0; }
  .repository-section { flex-direction: column; align-items: flex-start; }
  .legend { justify-content: flex-start; gap: 13px; }
}
@media(max-width:520px) {
  .board-panel,.controls,.playback { padding: 17px; }
  .maze-wrap { padding: 10px; min-height: 160px; }
  .stats,.comparing .stats { grid-template-columns: repeat(2,1fr); }
  .playback-top>.button-pair { width: 100%; flex-wrap: wrap; }
  .playback-top>.button-pair button { min-width: 80px; }
  .speed { width: 100%; }.speed input { flex: 1; }
  .timeline { font-size: .72rem; }
}
@media(prefers-reduced-motion:reduce) { html { scroll-behavior: auto; } }
