* { box-sizing: border-box; }
body { margin: 0; background: #f1f4e9; color: #203027; font: 1rem/1.5 "DM Sans", system-ui, sans-serif; }
main { max-width: 1070px; padding: clamp(16px, 4vw, 48px); margin: auto; }
header { margin-bottom: 25px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(3rem, 8vw, 5rem); line-height: 1; letter-spacing: -.08em; }
h1 span { color: #54813a; }
header p { margin-top: 12px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .95fr); gap: 20px; align-items: start; }
.panel { background: #fffdf6; border: 1px solid #d9e0d0; border-radius: 22px; padding: clamp(14px, 3vw, 25px); }
.heading, .actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.grid { display: grid; grid-template-columns: 1.5rem repeat(3, minmax(0, 1fr)); gap: 6px; align-items: center; text-align: center; }
#board { margin-top: 12px; }
.coordinate { font-weight: 700; color: #53644f; }
.tile { display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 0; border-radius: 12px; overflow: hidden; background: #e1e8da; }
.tile img { display: block; width: 100%; height: 100%; }
button { cursor: pointer; font: inherit; font-weight: 700; color: inherit; background: #e8eee1; border: 0; border-radius: 9px; padding: 8px 13px; }
button:hover { filter: brightness(.94); }
:focus-visible { outline: 3px solid #37652a; outline-offset: 3px; }
.goal { margin-top: 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.goal .grid { width: 105px; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.goal .tile { border-radius: 4px; }
.program > p { margin: 8px 0 14px; }
label { display: block; font-weight: 700; margin-bottom: 4px; }
textarea { width: 100%; min-height: 11rem; resize: vertical; border: 1px solid #bacab2; border-radius: 10px; background: #f5f7f0; color: #203027; padding: 13px; font: 1rem/1.5 "IBM Plex Mono", monospace; }
.actions { justify-content: flex-start; margin-top: 9px; }
#run { background: #315f39; color: white; }
#status { min-height: 3em; }
details { border-top: 1px solid #d9e0d0; padding-top: 12px; }
summary { cursor: pointer; font-weight: 700; }
ul { padding-left: 20px; }
li + li { margin-top: 6px; }
@media (max-width: 690px) { .layout { grid-template-columns: 1fr; } }
.challenges { margin-bottom: 20px; }
.challenges h2 { margin-bottom: 8px; }
.challenges p:not(:empty), #prediction, #sharing { margin-top: 10px; }
[hidden] { display: none !important; }
select, input { max-width: 100%; font: inherit; color: inherit; background: #f5f7f0; border: 1px solid #bacab2; border-radius: 8px; padding: 8px; }
#challenge-code { width: 12rem; }
#counter:not(:empty) { margin: 10px 0; font-weight: 700; }
.success { margin-top: 12px; padding: 12px 14px; border: 1px solid #8eb38b; border-radius: 10px; background: #e6f3df; color: #244f2b; font-weight: 700; }
.route { grid-template-columns: repeat(var(--route-size, 5), minmax(0, 1fr)); }
.route-cell { display: grid; place-items: center; aspect-ratio: 1; border-radius: 8px; background: #36463d; color: #203027; font-size: clamp(.64rem, 2.4vw, 1rem); font-weight: 700; }
.route-open { background: #dcefcf; }
.boards:has(#second-route:not([hidden])) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.boards h3 { margin-top: 12px; }
#second-board { margin-top: 12px; }
.trace { background: #edf3e6; border-radius: 8px; padding: 8px 12px; overflow-wrap: anywhere; }
#route-editor label { margin-top: 10px; }
.route-cell[type="button"] { width: 100%; padding: 0; }
#bonus { color: #315f39; font-weight: 700; }
pre { background: #f5f7f0; border-radius: 8px; padding: 10px 12px; overflow-x: auto; }
#progress { color: #315f39; font-weight: 700; margin: 0 0 10px; }
.route-robot { background: #f8e9aa; box-shadow: inset 0 0 0 2px #876810; }
button:disabled { cursor: default; opacity: .55; }
