/* Shared learning-panel reading scale. */
body.opened :is(#left,#right).paper {
  --lesson-body: clamp(15px, 1.1vw, 19px);
  --lesson-example: clamp(18px, 1.35vw, 24px);
  --lesson-pinyin: clamp(12px, .85vw, 15px);
  --lesson-translation: clamp(13px, .9vw, 16px);
  font-size: var(--lesson-body);
  line-height: 1.65;
}
body.opened :is(#left,#right).paper :is(p,li,td,.knowledge-row) {
  font-size: var(--lesson-body);
  line-height: 1.65;
}
body.opened :is(#left,#right).paper .han-pinyin {
  font-size: var(--lesson-pinyin);
}
body.opened :is(#left,#right).paper :is(.kicker,.learning-section-title) .han-pinyin {
  font-size: 11px;
}
body.opened :is(#left,#right).paper :is(.line,.review-phrase,.answer-examples) .character-annotation {
  font-size: var(--lesson-example);
}
body.opened :is(#left,#right).paper :is(.line,.review-phrase,.answer-examples) small {
  font-size: var(--lesson-translation);
}
body.opened :is(#left,#right).paper .panel-scale-button .han-pinyin {
  font-size: 10px;
}
.inline-answer {
  margin: 8px 0 12px;
}
.inline-answer summary,
.grammar-practice details summary {
  width: fit-content;
  color: #40543b;
  cursor: pointer;
}
.inline-answer .answer-examples small {
  display: block;
  color: #68785e;
}
.review-vocabulary {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(min(100%,112px),1fr));
  gap: 8px;
  list-style: none;
  padding: 0;
}
.review-vocabulary li {
  border: 1px solid #d8dfc7;
  border-radius: 7px;
  padding: 8px;
  text-align: center;
}
.review-vocabulary small {
  display: block;
  color: #68785e;
}
#dialogueDock #bubble {
  box-sizing: border-box;
  width: max-content;
  padding: 6px 12px;
}
#bubble[hidden] {
  display: none;
}
#bubble > .character-annotation,
#bubble > .character-annotation .word-reading {
  width: max-content;
  max-inline-size: none;
  flex-wrap: nowrap;
  white-space: nowrap;
}
#bubble > .character-annotation {
  font-size: 18px;
}
#bubble > .character-annotation .word-reading {
  gap: .16em;
}
#bubble > .character-annotation .han-pinyin {
  font-size: .78em;
  line-height: 1.25;
}
#bubble > .character-annotation :is(.han-char,.han-punctuation) {
  line-height: 1.3;
}
#bubble > small,
#bubble > .scene-message {
  display: block;
  width: max-content;
  margin: 3px auto 0;
  white-space: nowrap;
}
#modal {
  box-sizing: border-box;
  width: min(760px, calc(100vw - 24px));
  max-height: min(90dvh, 100%);
  overflow: hidden;
  padding: 66px clamp(16px, 4vw, 42px) 16px;
}
#modalContent {
  max-height: calc(90dvh - 84px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0 4px 14px;
}
#modal .word-heading h2 {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: .1em .45em;
  font-size: clamp(24px, 4vw, 34px);
}
#modal .word-heading-pinyin {
  font-size: 1em;
}
.current-stroke-name {
  display: grid;
  grid-template-columns: auto minmax(0,1fr);
  align-items: center;
  gap: .12em .55em;
  width: fit-content;
  max-width: 100%;
  padding: .45em .65em;
  color: #465b40;
  background: #f0f3e6;
  border: 1px solid #d8dfc7;
  border-radius: 7px;
  line-height: 1.35;
}
.current-stroke-name[hidden] {display: none}
.current-stroke-pinyin,
.current-stroke-name strong {grid-column: 1; justify-self: center}
.current-stroke-pinyin {font-size: .8em}
.current-stroke-name strong {font-size: 1.2em}
.current-stroke-english {grid-column: 2; grid-row: 1 / span 2; font-size: .9em}

/* Section markers delimit learning blocks. Topic names and table copy stay in their original reading style. */
:is(#left,#right).paper .learning-section-title,
:is(#left,#right).paper .single-component-section > .kicker {
  border-top: 1px solid #ded5bd;
  margin: 22px 0 12px;
  padding-top: 15px;
}
body.opened :is(#left,#right).paper h4:not(.learning-section-title) {
  border-top: 0;
  padding-top: 0;
}
body.opened :is(#left,#right).paper .grammar-rules h4 {
  color: #303d32;
  font-size: var(--lesson-body);
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: 0;
  margin: 10px 0 12px;
}

#modal .conversation-dialog {
  padding: 12px 4px 20px;
  text-align: start;
}
#modal .conversation-dialog .conversation-dialog-line {
  margin: 20px 0 12px;
  font-size: clamp(28px, 5.5vw, 50px);
  font-weight: 700;
  line-height: 1.35;
}
#modal .conversation-dialog-line :is(.character-annotation,.character-reading) {
  justify-content: flex-start;
}
#modal .conversation-dialog-line :is(.han-char,.han-punctuation) {
  font-weight: 700;
}
#modal .conversation-dialog-line .han-pinyin {
  font-size: .68em;
  font-weight: 700;
  line-height: 1.4;
}
#modal .conversation-dialog .conversation-dialog-translation {
  margin: 12px 0 24px;
  font-size: clamp(21px, 4vw, 32px);
  font-weight: 700;
  line-height: 1.35;
}
#modal .conversation-dialog-audio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.stroke-order-guide {
  width: 100%;
  margin: 10px 0 18px;
  border: 1px solid #d8dfc7;
  border-spacing: 0;
  border-radius: 9px;
  background: #f3f5ea;
}
body.opened :is(#left,#right).paper .stroke-order-guide td {
  padding: 7px clamp(6px, 1vw, 14px);
  font-size: clamp(13px, 1vw, 16px);
  line-height: 1.4;
}
.stroke-order-guide tr + tr td {
  border-top: 1px solid #dfe4d4;
}
.stroke-order-guide td:first-child,
.stroke-order-guide td:last-child {
  width: 45%;
}
.stroke-order-guide td:first-child {
  text-align: end;
}
body.opened :is(#left,#right).paper .stroke-order-guide .stroke-order-arrow {
  color: #52654c;
  font-size: 19px;
  font-weight: 600;
  text-align: center;
}

:is(#left,#right).paper details > summary {
  list-style-position: inside;
}
:is(#left,#right).paper details:not([open]) > summary::after {
  content: "click to expand";
  display: block;
  margin-top: 2px;
  color: #68785e;
  font-size: 12px;
  font-style: italic;
  font-weight: 400;
  line-height: 1.35;
}

body.opened :is(#left,#right).paper .lesson-tap-hint {
  margin: 6px 0 12px;
  color: #68785e;
  font-size: 14px;
  font-style: italic;
  font-weight: 400;
  line-height: 1.4;
}
:is(#left,#right).paper .stroke-order-rules > summary {
  display: list-item;
  list-style-type: disclosure-closed;
  color: #000;
  font-style: italic;
  cursor: pointer;
}
:is(#left,#right).paper .stroke-order-rules[open] > summary {
  list-style-type: disclosure-open;
}
:is(#left,#right).paper .stroke-order-rules > summary::marker {
  color: #000;
}

.review-vocabulary .review-word-audio {
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.review-vocabulary .review-word-audio:focus-visible,
.review-number-card button:focus-visible {
  outline: 2px solid #52654c;
  outline-offset: 2px;
}

.review-numbers:has(.review-number-card) {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
}
.review-number-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 3px;
  min-width: 0;
  padding: 4px;
  border: 1px solid #d3dbc4;
  border-radius: 8px;
  background: #f7f8ed;
}
.review-number-card .review-number-face {
  width: 100%;
  min-width: 0;
  min-height: 100px;
  border: 0;
  background: transparent;
}
.review-number-card :is(.review-number-front,.review-number-back)[hidden] {
  display: none;
}
.review-number-card img {
  width: 100%;
  max-width: 116px;
  height: auto;
  display: block;
  margin-inline: auto;
}
.review-number-card .review-number-back {
  display: block;
  min-width: 0;
}
.review-number-back .ten-gestures {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}
.review-number-back .ten-gestures img {
  min-width: 0;
}
.review-number-card .review-number-audio {
  min-height: 0;
  padding: 7px 5px;
  border: 0;
  background: transparent;
  font-size: 16px;
}

.audio-icon {
  position: relative;
  display: inline-block;
  width: 1.25em;
  height: 1em;
  color: #52654c;
  vertical-align: -.12em;
  flex: 0 0 auto;
}
.audio-icon::before {
  content: "";
  position: absolute;
  inset: 9% auto 9% 0;
  width: 58%;
  background: currentColor;
  clip-path: polygon(4% 33%, 32% 33%, 78% 4%, 92% 4%, 92% 96%, 78% 96%, 32% 67%, 4% 67%);
}
.audio-icon::after,
.audio-icon > span::after {
  content: "";
  position: absolute;
  border: .075em solid transparent;
  border-inline-end-color: currentColor;
  border-radius: 50%;
}
.audio-icon::after {
  width: 65%;
  height: 86%;
  inset: 0 0 auto auto;
}
.audio-icon > span::after {
  width: 39%;
  height: 49%;
  inset: 18% 15% auto auto;
}
:is(.word-speaker,.number-sound,.review-number-audio) {
  color: #52654c;
}
:is(.word-speaker,.number-sound,.review-number-audio):hover .audio-icon,
button:hover .audio-icon {
  color: #354935;
}

#modal .choice.toc > small {
  display: block;
}
#modal .choice.toc > small:first-child {
  text-align: left;
}
#modal .choice.toc > b,
#modal .choice.toc > small:last-child {
  text-align: center;
}
#modal .choice.toc :is(.aligned-title,.character-annotation,.character-reading) {
  justify-content: center;
}

.conversation-row {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #dfe4d4;
}
body.opened :is(#left,#right).paper .conversation-row .line {
  min-width: 0;
  border-bottom: 0;
}
.conversation-line-audio,
#modal .conversation-dialog-audio {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  min-width: 42px;
  min-height: 42px;
  padding: 6px;
  border: 1px solid #d3dbc4;
  border-radius: 7px;
  background: #f3f5ea;
  font-size: 17px;
}
#modal .conversation-dialog-audio {
  width: 52px;
  min-height: 48px;
  font-size: 21px;
}

.tone-speaker {
  margin-inline-start: 8px;
  vertical-align: middle;
  cursor: pointer;
}
.tone-word {
  display: inline-flex;
  align-items: center;
  margin: 4px 12px 4px 0;
}
