@charset "UTF-8";

/* Keep the controls horizontal; only worksheet text and kanji tiles use tategaki. */
body:has(.student-game) .site-header {
  height: 48px;
}
body:has(.student-game) .brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 21px;
}
body:has(.student-game) .brand {
  font-size: 14px;
  gap: 11px;
}
body:has(.student-game) .brand small {
  font-size: 7px;
  margin-top: 3px;
}
body:has(.student-game) .room-banner {
  min-height: 30px;
  padding: 5px 0;
}
body:has(.student-game) #game {
  padding-bottom: 10px;
}

.student-game,
.student-game.many-slots {
  --kanji-size: 32px;
  --prompt-height: clamp(240px, calc(100dvh - 425px), 350px);
  max-width: 1050px;
  min-width: 0;
  margin: 5px auto 0;
}
.student-game .question-top,
.student-game.many-slots .question-top {
  min-height: 34px;
  margin: 4px 0 10px;
  gap: 16px;
}
.student-game .question-card,
.student-game.many-slots .question-card {
  min-width: 0;
  padding: 12px 25px 14px;
}
.student-game .question-card-header,
.student-game.many-slots .question-card-header {
  min-height: 24px;
  padding-bottom: 7px;
  margin-bottom: 8px;
}

/* RTL flex ordering puts source row 1 on the right and makes narrow-screen
   scrolling start at that row. Each Japanese sentence itself runs top-down. */
.student-game .prompt-list,
.student-game.many-slots .prompt-list {
  display: flex;
  flex-direction: row;
  direction: rtl;
  align-items: flex-start;
  justify-content: flex-start;
  justify-content: safe center;
  gap: clamp(20px, 4vw, 48px);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 6px 12px 5px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: #cec8de transparent;
  writing-mode: horizontal-tb;
}
.student-game .prompt-row {
  display: flex;
  flex-direction: column;
  direction: ltr;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  min-width: 68px;
  padding: 0 15px 0 3px;
}
.student-game .prompt-index {
  width: 20px;
  height: 20px;
  margin: 0;
  font-size: 10px;
  writing-mode: horizontal-tb;
  direction: ltr;
}
.student-game .prompt-text,
.student-game.many-slots .prompt-text {
  flex: none;
  display: block;
  direction: ltr;
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-size: var(--kanji-size);
  font-weight: 600;
  line-height: 1.65;
  letter-spacing: 1px;
  height: var(--prompt-height);
  width: auto;
  min-width: 0;
  overflow-wrap: normal;
  word-break: normal;
  white-space: normal;
  text-align: start;
}
.student-game .prompt-text ruby {
  ruby-position: over;
  ruby-align: center;
}
.student-game .prompt-text ruby rt {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-size: 9px;
  line-height: 1;
  letter-spacing: 0;
}

.student-game .answer-slot,
.student-game.many-slots .answer-slot {
  writing-mode: vertical-rl;
  text-orientation: upright;
  direction: ltr;
  width: 48px;
  min-width: 48px;
  height: 54px;
  padding: 6px 4px;
  margin: 4px 0;
  border-radius: 10px;
  font-size: var(--kanji-size);
  line-height: 1.05;
  vertical-align: middle;
}
.student-game .answer-slot.word-slot,
.student-game.many-slots .answer-slot.word-slot {
  width: 48px;
  min-width: 48px;
  height: 80px;
  padding-top: 4px;
  padding-bottom: 4px;
}
.student-game .slot-value {
  display: block;
  writing-mode: vertical-rl;
  text-orientation: upright;
  line-height: 1.05;
  white-space: nowrap;
}
.student-game .slot-reading,
.student-game.many-slots .slot-reading {
  writing-mode: vertical-rl;
  text-orientation: upright;
  direction: ltr;
  top: 50%;
  right: -16px;
  left: auto;
  transform: translateY(-50%);
  font-size: 9px;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

.student-game .choice-area,
.student-game.many-slots .choice-area {
  margin-top: 10px;
  padding-top: 9px;
}
.student-game .choice-area-heading,
.student-game.many-slots .choice-area-heading {
  margin-bottom: 7px;
}
.student-game .choice-bank,
.student-game.many-slots .choice-bank {
  min-height: 55px;
  gap: 13px;
  direction: ltr;
  writing-mode: horizontal-tb;
}
.student-game .kanji-tile,
.student-game.many-slots .kanji-tile {
  writing-mode: vertical-rl;
  text-orientation: upright;
  direction: ltr;
  width: 58px;
  min-width: 58px;
  height: 55px;
  padding: 6px 8px;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: 0;
  border-radius: 11px;
  white-space: nowrap;
}
.student-game:has(.word-slot) .kanji-tile {
  height: 78px;
  padding-top: 4px;
  padding-bottom: 4px;
}
body:has(.student-game) .drag-ghost {
  writing-mode: vertical-rl;
  text-orientation: upright;
  direction: ltr;
  width: 58px;
  min-width: 58px;
  height: 55px;
  padding: 6px 8px;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: 0;
  white-space: nowrap;
}
body:has(.student-game .word-slot) .drag-ghost {
  height: 78px;
  padding-top: 4px;
  padding-bottom: 4px;
}
.student-game .question-actions,
.student-game.many-slots .question-actions {
  margin-top: 10px;
}
.student-game .submit-button,
.student-game.many-slots .submit-button {
  min-height: 44px;
}
.student-game .student-status-bar,
.student-game.many-slots .student-status-bar {
  margin-top: 8px;
}

/* A short Chromebook viewport keeps the characters large. Longer sentences
   continue in a second vertical line inside their numbered prompt. */
@media (min-width: 741px) and (max-height: 720px) {
  body:has(.student-game) .site-header { height: 42px; }
  .student-game,
  .student-game.many-slots {
    --kanji-size: 28px;
    --prompt-height: clamp(210px, calc(100dvh - 410px), 285px);
  }
  .student-game .prompt-list { gap: 28px; }
  .student-game .answer-slot,
  .student-game.many-slots .answer-slot { width: 44px; min-width: 44px; height: 48px; }
  .student-game .answer-slot.word-slot,
  .student-game.many-slots .answer-slot.word-slot { width: 44px; min-width: 44px; height: 70px; }
  .student-game .kanji-tile,
  .student-game.many-slots .kanji-tile,
  body:has(.student-game) .drag-ghost { font-size: 28px; }
  .student-game:has(.word-slot) .kanji-tile,
  body:has(.student-game .word-slot) .drag-ghost { height: 72px; }
  .student-game .student-status-bar > span { font-size: 9px; }
}

@media (max-width: 740px) {
  body:has(.student-game) .site-header { height: 52px; padding: 0 4%; }
  .student-game,
  .student-game.many-slots {
    --kanji-size: 28px;
    --prompt-height: clamp(225px, calc(100dvh - 435px), 320px);
  }
  .student-game .question-top,
  .student-game.many-slots .question-top { gap: 8px; margin: 5px 0 10px; }
  .student-game .timer-container { padding-top: 2px; }
  .student-game .question-card,
  .student-game.many-slots .question-card { padding: 12px 10px 14px; }
  .student-game .question-card-header,
  .student-game.many-slots .question-card-header { margin-bottom: 6px; }
  .student-game .prompt-list,
  .student-game.many-slots .prompt-list { gap: 18px; padding: 6px 7px 9px; }
  .student-game .prompt-row { min-width: 65px; padding-right: 14px; gap: 8px; }
  .student-game .answer-slot,
  .student-game.many-slots .answer-slot { width: 44px; min-width: 44px; height: 48px; }
  .student-game .answer-slot.word-slot,
  .student-game.many-slots .answer-slot.word-slot { width: 44px; min-width: 44px; height: 70px; }
  .student-game .prompt-text ruby rt { font-size: 8px; }
  .student-game .choice-bank { gap: 10px; }
  .student-game .kanji-tile,
  .student-game.many-slots .kanji-tile { width: 51px; min-width: 51px; font-size: 28px; }
  .student-game:has(.word-slot) .kanji-tile { height: 72px; }
  body:has(.student-game) .drag-ghost { font-size: 28px; }
  body:has(.student-game .word-slot) .drag-ghost { height: 72px; }
  .student-game .choice-area-heading span { max-width: 175px; }
  .student-game .submit-button { min-width: 130px; }
  .student-game .student-status-bar > span { display: none; }
}
