/* The summary and four opponent forms follow the supplied sheet. Each local
   alphabet keeps its 9/9/8 arrangement, with scrolling confined to its form. */
.pupil-sheet {
  min-width: 0;
  margin-block: 16px 24px;
  color: var(--ink);
}

.pupil-sheet-heading {
  margin-bottom: 16px;
}

.pupil-sheet-heading h2 {
  margin-bottom: 6px;
  font-size: clamp(1.35rem, 1.8vw, 1.8rem);
}

.pupil-sheet-heading p {
  margin: 0;
  font-size: .9rem;
  line-height: 1.5;
}

.pupil-sheet-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 20px;
  min-width: 0;
}

.pupil-sheet-summary {
  display: grid;
  gap: 18px;
  align-content: start;
  min-width: 0;
}

.pupil-sheet-summary > section,
.pupil-guess-record,
.pupil-opponent {
  min-width: 0;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--edge);
  border-radius: 4px;
}

.pupil-sheet-summary h3,
.pupil-guess-record h3 {
  margin: 0;
  padding: 12px;
  border-bottom: 1px solid var(--edge);
  background: var(--linen);
  text-align: center;
  font-size: 1.1rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.pupil-sheet-opponents {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  min-width: 0;
}

.pupil-opponent > h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--edge);
  background: var(--linen);
  font-size: 1.1rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.pupil-avatar {
  flex: none;
  width: 32px;
  height: 32px;
  border: 1px solid var(--edge);
  border-radius: 3px;
  object-fit: cover;
}

.pupil-opponent.pupil-empty {
  min-height: 220px;
  border-style: dashed;
}

.pupil-opponent.pupil-empty > p {
  margin: 0;
  padding: 20px 14px;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.5;
}

.pupil-alphabet-scroll {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-color: var(--edge) var(--paper);
  scrollbar-width: thin;
}

.pupil-alphabet {
  display: grid;
  grid-template-columns: repeat(9, minmax(44px, 1fr));
  gap: 2px;
  min-width: 414px;
  padding: 1px;
  background: var(--paper);
}

.pupil-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 44px;
  min-height: 44px;
  padding: 3px 1px;
  border: 1px solid var(--edge);
  border-radius: 2px;
  background: var(--paper);
  color: var(--forest);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.12rem;
  line-height: 1;
  font-weight: 700;
}

.pupil-mark {
  min-width: 10px;
  color: inherit;
  font-family: 'Trebuchet MS', Arial, sans-serif;
  font-size: .78rem;
  line-height: 1;
}

.pupil-letter[data-value='1'] {
  background: var(--mark-impossible-bg, #ead1c8);
  color: var(--mark-impossible-ink, #8e2a1e);
}

.pupil-letter[data-value='2'] {
  background: var(--mark-possible-bg, #f5e1ad);
  color: var(--mark-possible-ink, #6b480b);
}

.pupil-letter[data-value='3'] {
  background: var(--mark-certain-bg, #dce7d7);
  color: var(--mark-certain-ink, var(--forest));
}

.pupil-letter:disabled {
  opacity: 1;
  cursor: default;
  transform: none;
}

.pupil-letter:disabled[data-value='3'] {
  border: 3px double var(--forest);
  padding: 1px 0;
}

.pupil-letter.theory-choice,
.pupil-letter[aria-pressed='true'] {
  border: 2px solid var(--green);
  padding: 2px 0;
}

.pupil-letter.word-letter {
  border-color: var(--rust);
  box-shadow: inset 0 -3px var(--rust);
}

.pupil-clue-scroll {
  max-height: 320px;
  min-height: 132px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--edge) var(--paper);
  scrollbar-width: thin;
}

.pupil-clue-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  color: var(--ink);
  background: var(--paper);
  font-size: .86rem;
}

.pupil-clue-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px 6px;
  border-bottom: 1px solid var(--edge);
  background: var(--linen);
  color: var(--forest);
  text-align: left;
  overflow-wrap: anywhere;
}

.pupil-clue-table th:first-child {
  width: 31%;
}

.pupil-clue-table th:last-child {
  width: 42px;
  text-align: center;
}

.pupil-clue-table td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--pale);
  line-height: 1.3;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.pupil-clue-table td:nth-child(2) {
  padding: 4px 3px;
}

.pupil-clue-table td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: .74rem;
  line-height: 1.35;
}

.pupil-clue-table .answer-count {
  color: var(--forest);
  text-align: center;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pupil-clue-table .sheet-empty,
.pupil-clue-table .pupil-empty-clue {
  padding: 18px 12px;
  color: var(--muted);
  line-height: 1.5;
}

.pupil-blank-word {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  min-height: 36px;
  border: 1px solid var(--edge);
  border-radius: 2px;
}

.pupil-blank-word span {
  min-height: 34px;
  border-right: 1px solid var(--edge);
}

.pupil-blank-word span:last-child {
  border-right: 0;
}

.pupil-opponent > .pupil-alphabet-scroll {
  padding-top: 10px;
  border-top: 1px dashed var(--edge);
}

.pupil-guess-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
  margin-inline: 12px;
  padding-block: 10px;
  border-bottom: 1px solid var(--pale);
}

.pupil-guess-row:last-child {
  border-bottom: 0;
}

.pupil-guess-row > label,
.pupil-guess-row > span:first-child {
  min-width: 0;
  font-size: .83rem;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.pupil-guess-row .guess-letters {
  flex-wrap: wrap;
  gap: 4px;
}

.pupil-guess-record > p,
.pupil-guess-record > .sheet-caption {
  margin: 10px 12px 12px;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.5;
}

.pupil-sheet-controls {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--edge);
}

.pupil-sheet-controls p {
  margin-bottom: 8px;
  font-size: .84rem;
  line-height: 1.5;
}

.pupil-sheet-controls .legend {
  margin-block: 10px;
}

.pupil-sheet > .notes-area {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed var(--edge);
}

.pupil-sheet .pupil-letter:focus-visible,
.pupil-sheet .sheet-word:focus-visible {
  position: relative;
  z-index: 2;
  outline: 3px solid var(--rust);
  outline-offset: -3px;
  box-shadow: inset 0 0 0 5px var(--paper);
}

@media (min-width: 720px) {
  .pupil-sheet-opponents {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pupil-sheet-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pupil-sheet-summary > :first-child {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1440px) {
  .pupil-sheet-layout {
    grid-template-columns: minmax(414px, .95fr) minmax(0, 2fr);
    gap: 24px;
  }

  .pupil-sheet-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .pupil-sheet-summary > :first-child {
    grid-column: auto;
  }

  .pupil-guess-row {
    grid-template-columns: minmax(88px, 1fr) auto;
    align-items: center;
    gap: 8px;
  }
}

@media (hover: hover) {
  .pupil-letter:not(:disabled):hover {
    background: var(--paper-hover, #eee2cc);
  }
}

@media (max-width: 570px) {
  .pupil-clue-table th:first-child {
    width: 34%;
    font-size: .78rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pupil-sheet button {
    transition: none;
  }
}

@media (forced-colors: active) {
  .pupil-letter.theory-choice,
  .pupil-letter.word-letter,
  .pupil-letter[aria-pressed='true'],
  .pupil-letter:disabled[data-value='3'] {
    border: 3px double Highlight;
  }

  .pupil-sheet .pupil-letter:focus-visible,
  .pupil-sheet .sheet-word:focus-visible {
    outline-color: Highlight;
    box-shadow: none;
  }
}
