.truchet-intro {
  max-width: 46rem;
  padding-block: clamp(1.75rem, 4vw, 3.5rem) 1.5rem;
}

.truchet-intro h1 {
  margin: .35em 0 .4em;
  font: 400 clamp(2.25rem, 6vw, 4.25rem)/1.04 var(--serif, Georgia, serif);
  color: var(--green, #1d4233);
  text-wrap: balance;
}

.truchet-intro > p:last-child {
  max-width: 34rem;
  margin: 0;
  font-size: clamp(1rem, 2vw, 1.22rem);
}

.truchet-bench {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(16rem, 2fr);
  align-items: start;
  gap: clamp(1rem, 3vw, 2rem);
}

.truchet-plate,
.truchet-controls,
.truchet-answer,
.truchet-file {
  border: 1px solid var(--line, #d7c8af);
  border-radius: .45rem;
  padding: clamp(.85rem, 2.8vw, 1.6rem);
  background: var(--surface, #fff9ee);
}

.truchet-plate {
  border-top: 4px solid var(--green, #1d4233);
}

.truchet-pieces {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(.35rem, 1vw, 1rem);
}

.truchet-pieces figure,
.truchet-joined {
  margin: 0;
}

.truchet-pieces svg,
.truchet-joined svg {
  display: block;
  width: 100%;
  height: auto;
}

.truchet-pieces figcaption {
  text-align: center;
}

.truchet-pieces strong {
  display: block;
  font-family: monospace;
  letter-spacing: .08em;
}

.truchet-plate-note,
.truchet-joined figcaption,
#truchet-file-help {
  color: var(--muted, #594e3e);
  font-size: .93rem;
}

.truchet-controls h2,
.truchet-answer h2,
.truchet-file h2 {
  margin: 0 0 .4em;
  font: 400 clamp(1.45rem, 3vw, 2rem)/1.16 var(--serif, Georgia, serif);
  color: var(--green, #1d4233);
}

.truchet-controls fieldset {
  display: grid;
  gap: .45rem;
  margin: .8rem 0 0;
  padding: 0;
  border: 0;
  min-inline-size: 0;
}

.truchet-controls label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  padding: .55rem .65rem;
  border: 1px solid var(--line, #d7c8af);
  border-radius: .35rem;
  cursor: pointer;
}

.truchet-controls label:has(input:checked) {
  border-color: var(--rust, #9d422e);
  box-shadow: 0 0 0 1px var(--rust, #9d422e);
}

.truchet-controls input { accent-color: var(--green, #1d4233); }
.truchet-controls fieldset:disabled label { cursor: default; }

.truchet-answer,
.truchet-file {
  margin-top: clamp(1rem, 3vw, 2rem);
}

.truchet-answer {
  border-top: 4px solid var(--rust, #9d422e);
}

.truchet-counts {
  margin: .4rem 0 0;
  font: 400 clamp(1.3rem, 3.5vw, 2.1rem)/1.22 var(--serif, Georgia, serif);
  color: var(--rust, #9d422e);
}

.truchet-actions,
.truchet-next {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .55rem 1rem;
}

.truchet-actions [hidden] { display: none; }

.truchet-joined {
  max-width: 46rem;
  margin-block: 1.2rem;
  padding: .5rem .5rem 1rem;
  background: var(--paper, #f6eedf);
  border-radius: .35rem;
}

.truchet-joined figcaption {
  padding-inline: .55rem;
}

#truchet-trace[aria-pressed="true"] {
  box-shadow: inset 0 0 0 2px var(--rust, #9d422e);
}

.truchet-joined path[data-highlighted="true"] {
  stroke: var(--rust, #9d422e);
  stroke-width: .16;
}

.truchet-answer details { margin-top: 1rem; }
.truchet-answer summary,
.truchet-piece-description summary { cursor: pointer; }
.truchet-piece-description p { margin: .45rem 0 0; }

.truchet-file .truchet-actions { margin-top: .85rem; }
.truchet-file label.button { cursor: pointer; }
#truchet-open:disabled + label { opacity: .55; cursor: default; }
#truchet-open:focus-visible + label {
  outline: 3px solid var(--rust, #9d422e);
  outline-offset: 3px;
}

.truchet-feedback:empty { margin: 0; }
.truchet-error { color: var(--rust, #9d422e); font-weight: 600; }
.truchet-next { margin-block: 1.5rem 2.5rem; }

.truchet-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 45rem) {
  .truchet-bench { grid-template-columns: minmax(0, 1fr); }
}
