.fursona-sheets {
  display: grid;
  gap: 16px;
}

.fursona-sheet-section [hidden] { display: none; }

.fursona-sheet-card {
  min-width: 0;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--card-solid);
}

.fursona-sheet-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 6px;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 11px 11px 0 0;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-soft);
}

.fursona-sheet-header h3 {
  min-width: 0;
  margin: 0 0 0 2px;
  color: var(--color-primary-dark);
  font-size: 34px;
  font-weight: 850;
  line-height: 1.25;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.fursona-sheet-copy {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  justify-self: end;
  column-gap: 6px;
  row-gap: 0;
  margin-top: 28.5px;
  min-width: 0;
  width: max-content;
  max-width: 100%;
}

.fursona-sheet-copy .small-button {
  height: auto;
  min-height: 32px;
  max-width: 100%;
  padding: 4px 8px;
  white-space: normal;
}

.fursona-sheet-status {
  grid-column: 1 / -1;
  flex-basis: 100%;
  display: block;
  max-width: 100%;
  margin-top: 4px;
  color: var(--color-text);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.fursona-sheet-status:empty { margin-top: 0; }

.fursona-sheet-picture {
  width: 92px;
  align-self: center;
}

.fursona-sheet-picture img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.fursona-sheet-fields {
  min-width: 0;
  margin: 0;
  padding: 6px 20px 14px;
}

.fursona-sheet-fields > div {
  display: grid;
  grid-template-columns: 5.5em minmax(0, 1fr);
  align-items: start;
  gap: 14px;
  min-width: 0;
  min-height: 60px;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 14px;
  line-height: 1.65;
}

.fursona-sheet-fields > div:last-child {
  border-bottom: 0;
}

.fursona-sheet-fields dt {
  padding-top: 10px;
  color: var(--color-primary-dark);
  font-weight: 850;
}

.fursona-sheet-fields dd {
  min-width: 0;
  margin: 0;
  color: var(--color-text);
  font-weight: 600;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.fursona-sheet-fields[data-character-sheet-example] dd {
  padding: 10px 13px;
}

.fursona-sheet-input {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  color: var(--color-text);
  background: var(--color-surface-soft);
  font: inherit;
  line-height: inherit;
  overflow-wrap: anywhere;
  resize: vertical;
}

.fursona-sheet-input:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  background: var(--color-surface-soft);
}

.fursona-sheet-swatches {
  display: inline-flex;
  gap: 4px;
  margin-left: 7px;
  vertical-align: middle;
}

.fursona-sheet-swatch {
  width: 11px;
  height: 11px;
  border: 1px solid var(--color-border);
  border-radius: 50%;
}

.fursona-sheet-lilac { background: #C8ADE3; }
.fursona-sheet-white { background: #FFFFFF; }

.legal-section .fursona-sheet-note {
  margin-top: 14px;
}

.fursona-sheet-fallback {
  margin-top: 14px;
  color: var(--color-text);
}

.fursona-sheet-fallback label {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
}

.fursona-sheet-fallback textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  color: var(--color-text);
  font: inherit;
  line-height: 1.6;
  background: var(--card-solid);
  resize: vertical;
}

.fursona-sheet-fallback textarea:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
}

@supports (grid-template-rows: subgrid) {
  @media (min-width: 700px) {
    .fursona-sheets {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      grid-template-rows: auto repeat(12, auto);
      column-gap: 16px;
      row-gap: 0;
    }

    .fursona-sheet-card {
      display: grid;
      grid-row: 1 / span 13;
      grid-template-rows: subgrid;
    }

    .fursona-sheet-card:first-child { grid-column: 1; }
    .fursona-sheet-card:last-child { grid-column: 2; }

    .fursona-sheet-fields {
      display: grid;
      grid-row: 2 / span 12;
      grid-template-rows: subgrid;
    }
  }
}

@media (max-width: 699px), (pointer: coarse) {
  .fursona-sheet-copy .small-button { min-height: 44px; }
}

@media (min-width: 700px) and (max-width: 1100px), (max-width: 479px) {
  .fursona-sheet-copy { column-gap: 4px; }
  .fursona-sheet-copy .small-button {
    min-width: 0;
    padding: 4px 2px;
    font-size: 11px;
    line-height: 1.3;
    word-break: keep-all;
  }
}

@media (max-width: 699px) {
  .fursona-sheet-header { grid-template-columns: minmax(0, 1fr); }
  .fursona-sheet-header:has(.fursona-sheet-picture) { grid-template-columns: minmax(0, 1fr) auto; }
  .fursona-sheet-picture {
    grid-row: 1;
    grid-column: 2;
    justify-self: end;
  }
}

@media (max-width: 479px) {
  .fursona-sheet-header h3 { font-size: 30px; }
  .fursona-sheet-copy {
    width: 100%;
  }
  .fursona-sheet-status { text-align: right; }
  .fursona-sheet-fields { padding: 6px 14px 12px; }
  .fursona-sheet-fields > div {
    grid-template-columns: 5.5em minmax(0, 1fr);
    gap: 10px;
  }
}

@media (max-width: 359px) {
  .fursona-sheet-header h3 { font-size: 28px; }
  .fursona-sheet-copy .small-button { font-size: 10px; }
}

.fursona-sheet-print-output { display: none; }

@media print {
  @page { size: A4 portrait; margin: 16mm; }

  html:has(.fursona-sheet-print-output),
  body:has(> .fursona-sheet-print-output) {
    display: block !important;
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: white !important;
    color: #222 !important;
  }

  body:has(> .fursona-sheet-print-output) > :not(.fursona-sheet-print-output) {
    display: none !important;
  }

  .fursona-sheet-print-output {
    display: block;
    color: #222;
    background: white;
    font-size: 11pt;
    line-height: 1.6;
  }

  .fursona-sheet-print-output h2 {
    margin: 0 0 8mm;
    color: #222;
    font-size: 20pt;
    line-height: 1.3;
  }

  .fursona-sheet-print-output dl { margin: 0; }

  .fursona-sheet-print-output dl > div {
    padding: 3mm 0;
    border-bottom: 1px solid #bbb;
    break-inside: avoid;
  }

  .fursona-sheet-print-output dt {
    float: left;
    width: 27mm;
    font-weight: 700;
  }

  .fursona-sheet-print-output dd {
    min-height: 1.6em;
    margin: 0 0 0 31mm;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    orphans: 2;
    widows: 2;
  }
}
