/* The current question stays at the desk edge; confirmed cards remain on the
   table, and portrait inspection leaves that question available. */
.play-dock {
  position: sticky;
  top: 8px;
  z-index: 9;
  min-width: 0;
  margin-bottom: 12px;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--forest);
  border-radius: 5px;
  box-shadow: 0 4px 10px #140f1633;
}

.board-column .play-dock .turn-action-bar {
  position: static;
  padding: 6px 10px;
  margin: 0;
  gap: 8px;
  border: 0;
  border-bottom: 1px solid var(--edge);
  border-radius: 0;
  background: transparent;
}

.play-dock .turn-action-bar > img {
  width: 36px;
  height: 36px;
}

.play-dock .turn-action-copy {
  min-width: 0;
}

.play-dock .turn-action-copy h3 {
  margin-bottom: 0;
  color: var(--forest);
  font-size: 1.1rem;
  line-height: 1.3;
}

.play-dock .turn-action-copy p {
  font-size: .8rem;
}

.play-dock .action-paper {
  margin: 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.play-dock .action-paper > h3:first-child {
  display: none;
}

.play-dock .action-paper > p {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.35;
}

.play-dock .question-form {
  gap: 6px 8px;
  align-items: end;
  min-width: 0;
}

.play-dock .question-form label {
  margin-bottom: 4px;
  font-size: .8rem;
}

.play-dock .question-form .word-field {
  min-width: 0;
}

.play-dock #word {
  width: 160px;
  max-width: 100%;
  min-height: 44px;
  padding: 7px 8px;
  font-size: 1.45rem;
}

.play-dock .question-form select {
  width: 155px;
  max-width: 100%;
  min-height: 44px;
  padding: 7px 8px;
  font-size: .85rem;
}

.play-dock :is(.question-form button, .after-question button) {
  min-width: 44px;
  min-height: 44px;
  padding: 7px 10px;
  font-size: .8rem;
}

.play-dock .word-count {
  margin-top: 0;
  font-size: .8rem;
}

.play-dock .question-rule {
  margin-bottom: 7px;
  padding: 6px 8px;
  border-left: 3px solid var(--forest);
  background: var(--linen);
  color: var(--ink);
  font-size: .8rem;
  line-height: 1.35;
}

#question-targets {
  flex: 1 0 100%;
  grid-column: 1 / -1;
  min-width: 0;
  width: 100%;
}

#question-targets:empty {
  display: none;
}

.question-target-picker h4 {
  margin: 2px 0 6px;
  color: var(--forest);
  font-size: .85rem;
  line-height: 1.35;
}

.question-target-picker h4 b {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1rem;
  letter-spacing: .06em;
}

.ask-targets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.ask-targets button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 1 1 124px;
  max-width: 220px;
  min-width: 44px;
  min-height: 44px;
  padding: 5px 7px;
  border-color: var(--forest);
  background: var(--forest);
  color: var(--paper);
  font-size: .8rem;
  line-height: 1.25;
  text-align: left;
}

.ask-targets button img {
  width: 32px;
  height: 32px;
  max-width: 32px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--edge);
  border-radius: 50%;
}

.ask-targets button > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.ask-targets button small {
  display: block;
  margin-top: 3px;
  font-size: .8rem;
  line-height: 1.3;
}

.play-dock .ask-targets button:hover:not(:disabled) {
  background: #4f2030;
  color: var(--paper);
}

.ask-targets button:disabled {
  opacity: 1;
  background: var(--linen);
  color: var(--muted);
  border-color: var(--edge);
  border-style: dashed;
}

.board-column:has(.play-dock) .theory-dock {
  position: static;
}

.known-strip {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px 18px;
  min-width: 0;
  margin: 10px 0 14px;
  color: var(--table-ink, var(--ink));
}

.board-column .known-strip > section {
  min-width: 0;
  margin: 0;
}

.known-strip .own-class {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.known-strip .own-class > div:first-child {
  width: auto;
  max-width: 140px;
  margin: 0;
}

.known-strip :is(h3, .own-class h3, .playground-row h3, .private-peek h3) {
  margin: 0 0 4px;
  color: var(--table-heading, var(--forest));
  font-size: 1rem;
  line-height: 1.3;
}

.known-strip :is(p, .own-class p) {
  margin: 0;
  color: var(--table-muted, var(--muted));
  font-size: .8rem;
}

.known-strip .own-hand {
  flex: initial;
  gap: 5px;
}

.known-strip :is(.own-hand .pupil-card, .playground-row .pupil-card) {
  width: 60px;
  min-width: 44px;
  min-height: 44px;
  padding: 3px;
}

.known-strip .pupil-name {
  padding: 3px 0 1px;
  font-size: .8rem;
}

.known-strip .pupil-state {
  display: none;
}

.known-strip .letter {
  font-size: 1.05rem;
  left: 2px;
  top: 2px;
}

.known-strip .playground-row {
  flex-wrap: wrap;
  gap: 5px;
}

.known-strip .card-back {
  width: 44px;
  min-width: 44px;
  height: 60px;
}

.known-strip .private-peek {
  padding: 0;
  border: 0;
}

.known-strip .peek-list {
  gap: 5px;
}

.known-strip .peek-list button {
  min-height: 44px;
  min-width: 44px;
  font-size: .8rem;
}

.public-reveals {
  flex: 1 1 260px;
}

.public-reveal-groups {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px 14px;
  min-width: 0;
}

.public-reveal-group {
  min-width: 0;
  max-width: 100%;
}

.public-reveal-name {
  display: block;
  margin-bottom: 4px;
  color: var(--table-ink, var(--ink));
  font-size: .8rem;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.public-reveal-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.known-strip .revealed-pupil {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 5px;
  border: 1px solid var(--edge);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
}

.known-strip .revealed-pupil img {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 2px;
}

.known-strip .revealed-pupil b {
  position: absolute;
  right: 1px;
  bottom: 1px;
  min-width: 18px;
  height: 18px;
  padding-inline: 2px;
  background: var(--paper);
  color: var(--forest);
  border-radius: 2px;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 18px;
  line-height: 18px;
  text-align: center;
  pointer-events: none;
}

.known-strip .revealed-pupil.recent-reveal {
  border-color: var(--rust);
  box-shadow: 0 0 0 2px var(--table-accent, var(--rust));
}

.known-strip .reveal-empty {
  color: var(--table-muted, var(--muted));
  font-size: .8rem;
  line-height: 1.4;
}

#pupil-inspector {
  position: fixed;
  right: 8px;
  bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 7;
  width: min(360px, calc(100% - 20px));
  max-height: min(50dvh, 380px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 12px;
  border: 2px solid var(--forest);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 3px 6px 20px #140f164d;
  scrollbar-color: var(--edge) var(--paper);
  scrollbar-width: thin;
}

.mini-inspection {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.mini-inspection > img {
  width: 88px;
  height: 88px;
  flex: none;
  object-fit: cover;
  border: 3px solid var(--linen);
  border-radius: 4px;
}

.mini-inspection > div {
  min-width: 0;
}

#pupil-inspector :is(h2, h3) {
  margin: 0 0 5px;
  color: var(--forest);
  font-size: 1.15rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

#pupil-inspector :is(.inspect-letter, .mini-letter) {
  margin-bottom: 3px;
  color: var(--forest);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1;
}

#pupil-inspector p {
  margin: 4px 0;
  font-size: .85rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.inspector-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

.inspector-actions button {
  min-width: 44px;
  min-height: 44px;
  padding: 7px 9px;
  font-size: .8rem;
}

#pupil-inspector :focus-visible {
  outline: 3px solid var(--burgundy, var(--rust));
  outline-offset: -3px;
}

body.compact .play-dock {
  margin-bottom: 8px;
}

body.compact .play-dock .action-paper > p {
  display: none;
}

body.compact .play-dock .action-paper {
  margin: 0;
  padding: 6px 8px;
}

body.compact .known-strip {
  margin-block: 8px 10px;
  gap: 8px 12px;
}

body.compact .known-strip :is(.own-hand .pupil-card, .playground-row .pupil-card) {
  width: 54px;
}

details[data-fold='notes'] {
  margin-block: 10px;
  border: 1px solid var(--table-edge, var(--edge));
  border-radius: 4px;
  color: var(--table-ink, var(--ink));
}

details[data-fold='notes'] > summary {
  min-height: 44px;
  padding: 11px 10px;
  color: var(--table-heading, var(--forest));
  font-size: .85rem;
  font-weight: 700;
  line-height: 1.35;
  list-style-position: inside;
  cursor: pointer;
}

details[data-fold='notes'] .notes-area {
  margin: 8px 10px;
  border: 0;
  padding: 0;
}

details[data-fold='notes'] .notes-area p {
  color: var(--table-muted, var(--muted));
  font-size: .8rem;
}

.scoresheet details[data-fold='notes'],
.scoresheet details[data-fold='notes'] .notes-area {
  color: var(--ink);
  border-color: var(--edge);
}

.scoresheet details[data-fold='notes'] > summary {
  color: var(--forest);
}

.scoresheet details[data-fold='notes'] .notes-area p {
  color: var(--muted);
}

body.compact details.theory-dock > summary {
  min-height: 44px;
  padding: 10px 8px;
  color: var(--forest);
  font-size: .85rem;
  font-weight: 700;
  line-height: 1.35;
  cursor: pointer;
  list-style-position: inside;
}

@media (max-width: 570px) {
  .play-dock .turn-action-copy p {
    display: none;
  }

  .play-dock .question-rule {
    margin-bottom: 5px;
    padding: 4px 6px;
  }

  .play-dock .question-form:has(.question-target-picker) > .word-count {
    display: none;
  }

  .play-dock .question-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 6px;
  }

  .play-dock .question-form > div {
    min-width: 0;
  }

  .play-dock #word {
    width: 130px;
  }

  .play-dock .question-form select {
    width: 140px;
  }

  .play-dock .question-form button {
    max-width: 100%;
    padding-inline: 6px;
    white-space: normal;
  }

  .play-dock .word-count {
    line-height: 1.3;
  }

  .known-strip .own-class {
    display: block;
  }

  .known-strip .own-class > div:first-child {
    display: flex;
    align-items: baseline;
    gap: 8px;
    max-width: none;
    margin-bottom: 5px;
  }

  .known-strip .own-hand {
    flex-wrap: wrap;
  }
}

@media (min-width: 1180px) {
  .pupil-sheet-layout {
    grid-template-columns: minmax(280px, .85fr) minmax(0, 2fr);
  }

  .pupil-sheet-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .pupil-sheet-summary > :first-child {
    grid-column: auto;
  }
}

@media (forced-colors: active) {
  .play-dock, #pupil-inspector {
    border-color: ButtonText;
  }

  #pupil-inspector :focus-visible {
    outline-color: Highlight;
  }
}
