/* The sheet hangs from the top: the numbers folding away under Play (when the
   focus leaves them) must not move Play under a finger or the mouse. */
#panel.quilt-panel {
  width: min(480px, calc(100% - 18px));
  margin-block: max(12px, env(safe-area-inset-top)) auto;
  max-height: calc(100dvh - 24px);
  padding: 12px;
  overflow-y: auto;
}
#panel.quilt-panel[open] {
  display: flex;
  flex-direction: column;
}
.quilt-panel .panel-heading {
  flex: none;
  margin-bottom: 3px;
  padding-inline: 5px;
}
.quilt-panel #panelContent {
  flex: none;
}
.quilt-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  min-height: 0;
}
.quilt-scene-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 12px;
  padding-inline: 5px;
}
.quilt-scene-title {
  color: #704936;
  font-size: calc(18px * var(--bb-text, 1));
  line-height: 1.2;
  margin: 0;
  overflow-wrap: anywhere;
}
.quilt-scene-range {
  color: #795e49;
  font-size: calc(16px * var(--bb-text, 1));
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.quilt-surface {
  flex: none;
  max-height: 52dvh;
  position: relative;
  /* The local section position is preserved by the viewer on resize. Native
     anchoring to its resized sticky canvas would apply a second adjustment. */
  overflow-anchor: none;
  overflow-x: hidden;
  overflow-y: auto;
  border-radius: 14px;
  background: #e7d4b8;
  box-shadow: inset 0 0 0 1px #b5926c;
  touch-action: pan-y pinch-zoom;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #a48367 #e7d4b8;
  user-select: none;
  cursor: grab;
}
.quilt-surface:active {
  cursor: grabbing;
}
.quilt-surface canvas {
  position: sticky;
  top: 0;
  display: block;
  width: 100%;
  pointer-events: none;
}
.quilt-scroll-space {
  width: 1px;
  pointer-events: none;
}
.quilt-patterns button {
  min-width: 0;
  min-height: 44px;
  border-radius: 12px;
  font: inherit;
  font-size: calc(16px * var(--bb-text, 1));
  line-height: 1.2;
  font-weight: 900;
  padding: 9px 5px;
  touch-action: manipulation;
  overflow-wrap: anywhere;
}
.quilt-patterns button {
  border: 2px solid var(--brown);
  color: var(--brown);
  background: var(--cream);
  box-shadow: 0 2px 0 var(--brown);
}
.quilt-patterns button:disabled {
  color: #806d5c;
  background: #e9decb;
  border-color: #b9a48f;
  box-shadow: none;
  opacity: 1;
  cursor: default;
}
.quilt-view .btn {
  min-width: 0;
  font-size: calc(clamp(14px, 3.8vmin, 17px) * var(--bb-text, 1));
}
.quilt-view button:focus-visible,
.quilt-surface:focus-visible {
  outline: 3px solid #a74765;
  outline-offset: 2px;
}
.quilt-selection {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 10px;
  padding-inline: 5px;
}
.quilt-selection > div {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 8px;
  min-width: 100px;
}
.quilt-selected-name {
  font-size: calc(18px * var(--bb-text, 1));
  line-height: 1.3;
  overflow-wrap: break-word;
}
.quilt-selected-stars {
  font-size: calc(18px * var(--bb-text, 1));
  color: #916315;
}
/* Newer and older quilts, once there is more than one. */
.quilt-steps {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.quilt-steps[hidden] {
  display: none;
}
.quilt-hint {
  margin: 0;
  text-align: center;
  font-size: calc(15px * var(--bb-text, 1));
  font-weight: 800;
  color: #795e49;
}
/* The quilt's twenty patterns as numbers, for a keyboard: out of sight until one
   of them has the focus, then five to a row as its patches are. */
.quilt-patterns {
  flex: none;
  display: grid;
  /* five to a row, fewer once a number needs more room than a fifth: sized in
     the numbers' own font */
  font-size: calc(16px * var(--bb-text, 1));
  grid-template-columns: repeat(
    auto-fill,
    minmax(
      max(calc(var(--digits, 2) * 0.68em + 24px), calc((100% - 24px) / 5)),
      1fr
    )
  );
  gap: 6px;
  padding: 2px 5px 4px;
}
.quilt-patterns:not(:focus-within) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.quilt-patterns button {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.quilt-patterns .stitched {
  background: #e4edcd;
}
.quilt-patterns .set-aside {
  border-style: dashed;
}
.quilt-patterns [aria-pressed="true"] {
  box-shadow: inset 0 0 0 3px #a74765;
}
.quilt-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

