/*
 * Layout for this tool only. Tokens and every component (app bar, chips, inputs, code, theme toggle)
 * come from dotmatrix/dotmatrix.css, synced from Tools/dotmatrix. Don't restyle components here.
 */
.wrap {
  max-width: var(--container);
  margin-inline: auto;
  padding: 0 var(--gutter) var(--space-16);
}

.intro {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-block: var(--space-8) var(--space-6);
}

.layout {
  display: grid;
  grid-template-columns: 22.5rem minmax(0, 1fr);
  align-items: start;
  gap: var(--space-6);
}

.controls {
  display: grid;
  gap: var(--space-6);
}

.counter {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.counter output {
  min-width: 2ch;
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  text-align: center;
}

.preview-wrap {
  display: grid;
  gap: var(--space-6);
  min-width: 0;
}

/* The board: items rearrange on the dot grid. */
.preview {
  min-height: 23.75rem;
  padding: var(--space-5);
  overflow: auto;
  resize: vertical;
  border-radius: var(--radius-tile);
  box-shadow: inset 0 0 0 1px var(--line);
}

.item {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 3.75rem;
  min-height: 3.75rem;
  border-radius: var(--radius-inset);
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
}

.item:nth-child(3n + 2) {
  min-height: 5.625rem;
}

.item:nth-child(4n + 3) {
  min-height: 7.375rem;
  padding-inline: var(--space-5);
}

.code-card {
  display: grid;
  gap: var(--space-4);
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.code-card pre {
  max-height: 20.625rem;
}

@media (width < 56.25rem) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (width >= 48rem) {
  .wrap {
    padding-inline: var(--gutter-md);
  }
}
