:root{--bg:#dce9e5;--board:#163d48;--dark:#185162}
*{box-sizing:border-box} html{color-scheme:light} body{margin:0;min-height:100vh;background:var(--bg);color:#242d29;font:16px/1.5 system-ui,sans-serif} main{max-width:980px;margin:auto;padding:20px clamp(14px,4vw,44px) 40px} a{color:inherit}header{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px}header a{text-decoration:none;font-weight:750}header small{font-size:.82rem}h1{font:normal clamp(2.6rem,8vw,5rem)/1 Georgia,serif;letter-spacing:-.05em;margin:0 0 .32em}h2{font:normal 1.65rem Georgia,serif;margin:.2rem 0 .7rem}.intro{margin:0 0 1rem;max-width:55ch}.layout{display:grid;grid-template-columns:minmax(0,1.55fr) minmax(225px,1fr);gap:22px;align-items:start}.panel{background:#fffaf0;border:1px solid #41443844;border-radius:16px;padding:18px}.board{width:100%;height:auto;display:block;border-radius:16px;background:var(--board)}.score{font-weight:750;margin:.1rem 0 1rem}button,input,select{font:inherit}button{padding:.65rem .95rem;border-radius:8px;border:1px solid #253f36;background:#fff;color:#253f36;cursor:pointer}button.main{background:var(--dark);color:white;font-weight:700}button:disabled{opacity:.52;cursor:default}button:focus-visible,input:focus-visible{outline:3px solid #a64410;outline-offset:2px}.buttons{display:flex;flex-wrap:wrap;gap:.45rem;margin:.55rem 0}.controls label{display:block;font-size:.92rem;font-weight:650;margin:.55rem 0}.controls input{display:block;width:100%;accent-color:var(--dark)}details{margin-top:1.1rem;border-top:1px solid #aaa6;padding-top:.65rem}summary{cursor:pointer;font-weight:bold}.status{min-height:3.2em;margin:.65rem 0;line-height:1.4}svg text,canvas{font-family:system-ui,sans-serif}@media(max-width:650px){.layout{grid-template-columns:1fr;gap:12px}.panel{padding:14px}main{padding-top:12px}header{margin-bottom:14px}}@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important}}
canvas{border:6px solid #234b50}#levels{padding:.35rem .5rem}button[hidden]{display:none}

.actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .45rem;
}

@media (max-width: 650px) {
  main { padding-top: 8px; }
  header { margin-bottom: 5px; }
  header a { padding-block: 4px; }
  h1 { margin-bottom: 4px; font-size: clamp(2rem, 8vw, 2.6rem); }
  .intro { margin-bottom: 10px; line-height: 1.35; }
  .layout { gap: 8px; }
  #levels { margin: 6px 0 0; padding: 0; text-align: center; }
  .panel { padding: 12px; }
  #stage { margin: 0; font-size: 1.35rem; }
  #moves { margin: 2px 0 8px; }
  button { padding: 6px 10px; min-height: 44px; line-height: 1.2; }
  .status { margin: 8px 0; min-height: 2.65em; line-height: 1.3; }
  .buttons { margin: 0; }
}
