/* Printed clue tables surround one alphabet tracker; paper and stitched dividers
   keep this alternate view on the woodland tabletop. */
.game-layout.sheet-layout {
  display: block;
  min-width: 0;
}

.scoresheet {
  --row-width: 80px;
  min-width: 0;
  margin-block: 16px 24px;
  padding-block: 18px 16px;
  background: var(--paper);
  border: 1px solid var(--edge);
  border-radius: 4px;
}

.scoresheet-heading,
.sheet-alphabet > h3,
.sheet-alphabet > p,
.sheet-alphabet > .legend {
  margin-inline: 14px;
}

.scoresheet-heading {
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--edge);
}

.scoresheet-heading h2 {
  margin-bottom: 6px;
  font-size: clamp(1.35rem, 1.8vw, 1.75rem);
}

.scoresheet-heading p,
.sheet-alphabet > p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.5;
}

.sheet-clues {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 14px;
  margin: 18px 14px 10px;
}

.sheet-opponent {
  min-width: 0;
  border: 1px solid var(--edge);
  border-radius: 3px;
  background: var(--paper);
}

.sheet-opponent h3 {
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--edge);
  background: var(--linen);
  font-size: 1.08rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.sheet-clue-scroll {
  max-height: 22rem;
  min-height: 110px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--edge) var(--paper);
  scrollbar-width: thin;
}

.sheet-clue-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: var(--paper);
  font-size: .86rem;
}

.sheet-clue-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 7px 5px;
  border-bottom: 1px solid var(--edge);
  background: var(--linen);
  color: var(--forest);
  text-align: left;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.sheet-clue-table th:first-child {
  width: 30%;
}

.sheet-clue-table th:last-child {
  width: 42px;
  text-align: center;
}

.sheet-clue-table td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--pale);
  vertical-align: middle;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.sheet-clue-table td:nth-child(2) {
  padding: 4px 2px;
}

.sheet-clue-table td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.35;
}

.sheet-word {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
  width: 100%;
  min-width: 44px;
  min-height: 44px;
  padding: 3px 1px;
  border: 1px solid var(--edge);
  border-radius: 2px;
  background: var(--paper);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.08rem;
  font-weight: 700;
}

.sheet-word span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 30px;
  border-right: 1px solid var(--edge);
}

.sheet-word span:last-child {
  border-right: 0;
}

.sheet-clue-table .answer-count,
.sheet-clue-table .answercount {
  color: var(--forest);
  text-align: center;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.4rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sheet-clue-table .sheet-empty {
  padding: 18px 12px;
  color: var(--muted);
  line-height: 1.5;
}

.scoresheet > .sheet-caption {
  margin: 10px 14px 22px;
}

.sheet-caption {
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.sheet-alphabet {
  min-width: 0;
  padding-top: 16px;
  border-top: 1px dashed var(--edge);
}

.sheet-alphabet > h3 {
  margin-bottom: 7px;
  font-size: clamp(1.15rem, 1.5vw, 1.4rem);
}

.sheet-alphabet > .legend {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 14px;
  margin-block: 12px 14px;
  font-size: .8rem;
}

/* Equal letter widths across partial bands preserve A-Z scanning on phones. */
.alphabet-bands {
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-color: var(--edge) var(--paper);
}

.alphabet-table {
  width: calc(var(--row-width) + (100% - var(--row-width)) * var(--letter-count) / var(--band-size));
  min-width: calc(var(--row-width) + var(--letter-count) * 46px + 2px);
  margin: 0 0 10px;
  border-collapse: separate;
  border-spacing: 2px;
  table-layout: fixed;
}

.alphabet-table:last-child {
  margin-bottom: 0;
}

.alphabet-table th,
.alphabet-table td {
  min-width: 0;
  padding: 0;
  text-align: center;
  vertical-align: middle;
}

.alphabet-table th:first-child {
  width: var(--row-width);
  padding: 6px 7px;
  background: var(--linen);
  color: var(--ink);
  text-align: left;
  font-size: .78rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.alphabet-table thead th:first-child {
  color: var(--forest);
  font-weight: 700;
}

.sheet-letter {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
  min-width: 44px;
  min-height: 64px;
  padding: 3px 1px;
  border: 1px solid var(--edge);
  border-radius: 3px;
  background: var(--linen);
  color: var(--forest);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.1rem;
  line-height: 1;
}

.sheet-letter img {
  width: 32px;
  height: 32px;
  border-radius: 2px;
  object-fit: cover;
}

.sheet-letter > span {
  min-height: 20px;
  line-height: 20px;
}

.sheet-letter.theory-choice {
  border: 2px solid var(--green);
  padding: 2px 0;
  background: #dce7d7;
}

.sheet-letter.theory-choice > span::after {
  content: ' ✓';
  font-family: 'Trebuchet MS', Arial, sans-serif;
  font-size: .8rem;
}

.sheet-letter.word-letter {
  border-color: var(--rust);
  box-shadow: inset 0 -3px var(--rust);
}

.alphabet-table .note-mark {
  display: block;
  width: 100%;
  min-width: 44px;
  min-height: 44px;
  padding: 3px;
  border-color: var(--edge);
  border-radius: 3px;
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 700;
}

.alphabet-table .note-mark[data-value='1'] {
  color: #8e2a1e;
}

.alphabet-table .note-mark[data-value='2'] {
  color: #6b480b;
}

.alphabet-table .note-mark[data-value='3'] {
  color: var(--forest);
}

.alphabet-table .note-mark:disabled {
  opacity: 1;
  cursor: default;
  transform: none;
}

.alphabet-table .note-mark:disabled[data-value='3'] {
  border: 3px double var(--forest);
  padding: 1px;
}

.alphabet-table .hooky-row th {
  color: var(--forest);
  font-weight: 700;
  border-top: 2px solid var(--forest);
}

.alphabet-table .hooky-row td {
  padding-top: 2px;
}

.alphabet-table .self-row th {
  font-style: italic;
}

.scoresheet .sheet-word:focus-visible,
.scoresheet .sheet-letter:focus-visible,
.scoresheet .note-mark:focus-visible {
  position: relative;
  z-index: 2;
  outline: 3px solid var(--rust);
  outline-offset: -3px;
  box-shadow: inset 0 0 0 5px var(--paper);
}

.sheet-guesses {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 18px;
  margin: 24px 14px 0;
  padding-top: 18px;
  border-top: 1px dashed var(--edge);
}

.guess-record {
  min-width: 0;
}

.guess-record h3 {
  margin-bottom: 8px;
  font-size: 1.15rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.guess-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  padding: 9px 0;
  border-bottom: 1px solid var(--pale);
}

.guess-row > span:first-child,
.guess-row > label {
  min-width: 0;
  font-size: .82rem;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.guess-letters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}

.guess-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  min-height: 34px;
  border: 1px solid var(--edge);
  border-radius: 2px;
  background: var(--linen);
  color: var(--forest);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.08rem;
  font-weight: 700;
}

.guess-points {
  min-width: 0;
  color: var(--muted);
  font-size: .75rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.guess-record > .sheet-caption {
  margin: 10px 0 0;
}

.scoresheet > .notes-area {
  margin: 22px 14px 0;
  padding-top: 16px;
  border-top: 1px dashed var(--edge);
}

@media (min-width: 900px) {
  .scoresheet {
    --row-width: 112px;
  }

  .guess-row {
    grid-template-columns: minmax(88px, 112px) minmax(0, 1fr) minmax(64px, 90px);
    align-items: center;
    gap: 10px;
  }
}

@media (max-width: 369px) {
  .scoresheet-heading,
  .sheet-alphabet > h3,
  .sheet-alphabet > p,
  .sheet-alphabet > .legend {
    margin-inline: 10px;
  }

  .sheet-clues {
    margin-inline: 10px;
  }

  .sheet-guesses,
  .scoresheet > .notes-area {
    margin-inline: 10px;
  }

  .alphabet-table th:first-child {
    padding-inline: 5px;
    font-size: .75rem;
  }
}

@media (hover: hover) {
  .sheet-letter:hover,
  .sheet-word:hover,
  .alphabet-table .note-mark:not(:disabled):hover {
    background: #eee2cc;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scoresheet button {
    transition: none;
  }
}

@media (forced-colors: active) {
  .sheet-letter.theory-choice,
  .sheet-letter.word-letter,
  .alphabet-table .note-mark:disabled[data-value='3'] {
    border: 3px double Highlight;
  }

  .scoresheet .sheet-word:focus-visible,
  .scoresheet .sheet-letter:focus-visible,
  .scoresheet .note-mark:focus-visible {
    outline-color: Highlight;
    box-shadow: none;
  }
}
