.rmath-header {
  display: block;
  background: #fff;
  color: #193b37;
  border-bottom: 1px solid #d7dfd7;
}
.rmath-header > .rmath-bar {
  width: 100%;
  max-width: 1040px;
  min-height: 60px;
  height: auto;
  margin: 0 auto;
  padding: 8px clamp(12px, 3vw, 24px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 12px;
}
.rmath-brand {
  font: 700 24px Georgia, serif;
  white-space: nowrap;
}
.rmath-brand em {
  color: #087c73;
}
.rmath-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.rmath-links a,
.puzzle-page .toolbar > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 38px;
  padding: 7px 11px;
  border: 1px solid #bdcfc4;
  border-radius: 10px;
  background: #fff;
  box-shadow: none;
  color: #23433c;
  font: 650 13px/1.3 system-ui, sans-serif;
  text-decoration: none;
  white-space: nowrap;
}
.rmath-links a:hover,
.puzzle-page .toolbar button:hover:enabled {
  background: #e6f0e9;
}
.rmath-links a:focus-visible,
.puzzle-page .toolbar :focus-visible {
  outline: 2px solid #087c73;
  outline-offset: 2px;
}
.puzzle-page .toolbar :is(#mix, #shuffle) {
  background: #087c73;
  border-color: #087c73;
  color: white;
}
.puzzle-page .toolbar :is(#mix, #shuffle):hover:enabled {
  background: #06675f;
}
.puzzle-page .toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px;
}
@media screen {
  body.puzzle-page {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    margin: 0;
    padding: 0;
    place-items: stretch;
    background: radial-gradient(ellipse at center, #fcfdf9, #edf3ef 65%, #e0ebe3);
  }
  .puzzle-page > main {
    min-height: 0;
    width: 100%;
    height: 100%;
    padding-top: 0;
  }
  .puzzle-tetra > main {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    padding: 0;
  }
  .puzzle-tetra #scene {
    height: 100%;
  }
  .puzzle-numbers > main {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto minmax(0, 1fr);
    justify-items: stretch;
    width: min(100%, 492px);
    padding: 0 12px;
    container-type: size;
  }
  .puzzle-numbers .number-summary {
    align-self: end;
  }
  .puzzle-numbers .number-summary p {
    margin: 4px 0 10px;
  }
  .puzzle-numbers .frame {
    width: min(100%, 460px, max(140px, 100cqh - 193px));
    justify-self: center;
  }
  .puzzle-numbers .status {
    align-self: start;
    margin: 12px 0 0;
  }
}
.number-summary h1,
.number-summary output {
  display: inline;
}
.number-summary output {
  float: right;
  padding-top: 6px;
}
@media screen and (max-height: 460px) and (min-aspect-ratio: 4/3) {
  .puzzle-page .rmath-bar {
    min-height: 44px;
    padding-block: 3px;
  }
  .puzzle-numbers > main {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-rows: auto 1fr auto;
    align-items: center;
    gap: 8px;
    width: min(100%, 620px);
  }
  .puzzle-numbers .toolbar {
    grid-column: 1 / -1;
  }
  .puzzle-numbers .number-summary {
    align-self: center;
  }
  .puzzle-numbers .frame {
    grid-column: 2;
    grid-row: 2 / 4;
    width: min(42vw, 100cqh - 65px);
  }
}
@media print {
  .rmath-header,
  .puzzle-page .toolbar {
    display: none !important;
  }
}
