:root {
  font-family: Inter, system-ui, -apple-system, sans-serif;
  font-synthesis: none;
  color: #183e3b;
  background: #fbfaf4;
  line-height: 1.5;
  --green: #185d51;
  --ink: #193e3a;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
a, summary, #copy { color: var(--green); text-underline-offset: 3px; }
button, input { font: inherit; }
button, summary { cursor: pointer; }
button, a, summary { touch-action: manipulation; }
:focus-visible { outline: 3px solid #bb651a; outline-offset: 4px; }
.skip { position: absolute; top: -5rem; left: 1rem; background: #fff; padding: .6rem; z-index: 2; }
.skip:focus { top: .5rem; }
.topbar {
  max-width: 1080px;
  margin: auto;
  padding: 18px clamp(16px, 4vw, 48px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #d7ded1;
}
.topbar > a { min-height: 44px; display: inline-flex; align-items: center; font-weight: 650; }
.brand { color: var(--ink); text-decoration: none; font-weight: 800 !important; font-size: 22px; letter-spacing: -.045em; }
.brand img { margin-right: 7px; border-radius: 8px; }
.brand sup { font-size: 10px; align-self: center; transform: translateY(-7px); }
main { max-width: 1040px; padding: clamp(24px, 4vw, 50px) clamp(16px, 4vw, 48px) 60px; margin: auto; }
.heading { max-width: 720px; }
.subject { color: #4c6d60; font-weight: 700; font-size: .9rem; margin: 0 0 .35rem; }
h1 { font-size: clamp(2.4rem, 6vw, 4.4rem); line-height: 1.03; margin: 0; letter-spacing: -.055em; }
#intro { color: #465e54; font-size: clamp(1rem, 2vw, 1.18rem); margin: .85rem 0 1.5rem; }
.activity {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.03fr);
  align-items: start;
  gap: clamp(1.25rem, 4vw, 3rem);
}
.board {
  min-width: 0;
  margin: 0;
  border-radius: 24px;
  overflow: hidden;
  color: #fffaf0;
  background: #185247;
}
.board-space { aspect-ratio: 1.26; display: grid; place-items: center; container-type: inline-size; }
.array {
  --columns: 6;
  display: grid;
  grid-template-columns: repeat(var(--columns), 1fr);
  gap: clamp(7px, 2cqw, 12px);
  transform: rotate(0deg);
  transition: transform .6s cubic-bezier(.2,.75,.25,1);
}
.array.smaller { --columns: 5; }
.array.turned { transform: rotate(90deg); }
.array i {
  width: clamp(14px, 7.7cqw, 38px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: #e9efd3;
}
.array i:first-child { background: #ffc769; box-shadow: inset 0 0 0 3px #f4ad4a; }
figcaption {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px clamp(12px, 3vw, 20px);
  border-top: 1px solid #ffffff35;
}
#dimensions { font-size: 1.1rem; font-weight: 700; }
#turn { background: transparent; color: #fff; border: 1px solid #bdd2c4; border-radius: 24px; padding: 6px 13px; min-height: 44px; }
#turn span { font-size: 1.17em; }
#turn:hover { background: #ffffff16; }
.question { min-width: 0; padding: .3rem 0; }
h2 { font-size: clamp(1.38rem, 3.1vw, 2rem); letter-spacing: -.035em; line-height: 1.18; margin: 0 0 1rem; }
.choices { display: grid; gap: 8px; }
.choices button {
  width: 100%;
  text-align: left;
  font-weight: 580;
  color: var(--ink);
  border: 1px solid #bccdbf;
  background: #fffefb;
  border-radius: 12px;
  padding: 11px 16px;
  min-height: 48px;
}
.choices button:hover { border-color: var(--green); background: #f1f5e9; }
#hint { margin-top: .6rem; }
#hint summary { width: fit-content; padding: .6rem .2rem; min-height: 44px; font-weight: 600; }
#hint p { color: #465e54; margin: 0 0 1rem; }
#feedback:not(:empty) { margin: .7rem 0; padding: .75rem 1rem; border-inline-start: 4px solid #b57a37; background: #f7eedb; }
#feedback.correct:not(:empty) { background: #e8f1e1; border-color: var(--green); }
.primary { background: var(--green); color: #fff; min-height: 46px; padding: 10px 17px; border: 0; border-radius: 10px; font-weight: 650; }
.primary:hover { background: #10483f; }
.number-controls { display: flex; gap: .75rem; align-items: stretch; margin: .4rem 0; }
input { border: 1px solid #829d8e; background: white; border-radius: 8px; color: var(--ink); padding: .6rem; max-width: 100%; }
#number { width: 4rem; text-align: center; }
.parents { margin: 2rem 0 0; padding: 0 0 1rem; border-block: 1px solid #d7ded1; }
.parents summary { width: fit-content; font-size: 1.1rem; font-weight: 700; padding: .85rem 0; min-height: 44px; }
.parents:not([open]) { padding-bottom: 0; }
.parents p { margin: .4rem 0 .8rem; max-width: 65ch; }
.parent-links { display: flex; flex-wrap: wrap; align-items: center; gap: .1rem 1.4rem; }
.parent-links > * { min-height: 44px; display: inline-flex; align-items: center; font-weight: 650; }
#copy { border: none; background: none; text-decoration: underline; padding: 0; }
#share-status:empty { display: none; }
#manual-copy input { width: 23rem; display: block; margin-top: .4rem; }
@media (max-width: 660px) {
  .topbar { padding-block: 5px; }
  .activity { grid-template-columns: 1fr; gap: 1rem; }
  .board-space { aspect-ratio: 1.6; }
  .board { border-radius: 18px; }
  .parents { margin-top: 1.2rem; }
}
@media (prefers-reduced-motion: reduce) {
  .array { transition: none; }
}
