/* HSK4 One | Flashcard layout fix | 2026-11-01
   Reserve a real header row for the origin label and the word audio button.
   Positioning the controls absolutely caused the Chinese word to overlap
   the header, especially in the short iPhone flashcard viewport. */
.study-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  min-width: 0;
  overflow: hidden;
}
.study-card .flash-card-toolbar {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  flex: 0 0 auto;
  min-height: 38px;
  text-align: left;
}
.study-card .flash-card-toolbar .wordtag {
  position: static;
  top: auto;
  right: auto;
  bottom: auto;
  left: auto;
  flex: 0 1 auto;
  min-width: 0;
  max-width: none;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  margin: 0;
  font-size: 10px;
  line-height: 1.35;
}
.study-card .flash-card-toolbar .audio-in-card {
  position: static;
  top: auto;
  right: auto;
  bottom: auto;
  left: auto;
  z-index: 5;
  flex: 0 0 auto;
  margin: 0;
  min-height: 36px;
  padding: 8px 12px;
  touch-action: manipulation;
}
.study-card #flashContent {
  position: relative;
  z-index: 2;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0 auto;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  text-align: center;
  padding: 14px 3px;
}
.study-card #flashContent::-webkit-scrollbar { display: none; }
.study-card #flashContent > * { flex-shrink: 0; max-width: 100%; }
.study-card #flashContent .back-example,
.study-card #flashContent .back-example-py,
.study-card #flashContent .back-english { text-align:center; }

/* Compact iPhone/Android: header and playback never overlap the word,
   and the content uses the available space rather than growing underneath. */
@media(max-width:700px) {
  .study-card {
    padding: 9px 12px 9px;
    overflow: hidden;
  }
  .study-card .flash-card-toolbar { min-height: 39px; gap: 6px; }
  .study-card .flash-card-toolbar .wordtag {
    font-size: 9px;
    padding: 6px 8px;
    line-height: 1.2;
    max-width: none;
  }
  .study-card .flash-card-toolbar .audio-in-card {
    min-height: 36px;
    padding: 7px 10px;
    font-size: 11px;
  }
  .study-card #flashContent { padding: 6px 3px 5px; }
  .study-card .back-main { font-size: clamp(30px, 8.5vw, 45px); line-height: 1.2; }
  .study-card .front-main { font-size: clamp(42px, 13vw, 76px); line-height: 1.16; }
  .study-card .back-py { font-size: 14px; margin: 3px 0 6px; }
  .study-card .back-meaning { font-size: clamp(15px, 4vw, 19px); line-height: 1.32; margin: 2px 0 5px; }
  .study-card #flashContent .back-example { font-size: clamp(16px, 4.2vw, 19px); margin-top: 8px; padding-top: 10px; line-height: 1.35; }
  .study-card #flashContent .back-example-py { font-size: 12px; line-height: 1.45; margin-top: 3px; }
  .study-card #flashContent .back-english { font-size: 12px; line-height: 1.45; margin-top: 3px; }
  .study-card #flashContent button { min-height: 34px; font-size: 11px; margin-top: 6px !important; }
  .study-card #flashContent .flip-hint { margin-top: 10px; font-size: 10px; }
}
@media(max-width:700px) and (max-height:700px) {
  .study-card { padding: 5px 9px; }
  .study-card .flash-card-toolbar { min-height: 32px; }
  .study-card .flash-card-toolbar .audio-in-card { min-height: 31px; padding: 4px 8px; }
  .study-card #flashContent { padding: 2px 3px; }
  .study-card .back-main { font-size: clamp(26px, 7vw, 35px); }
  .study-card .back-py { margin: 1px 0 2px; font-size: 12px; }
  .study-card .back-meaning { font-size: 14px; }
  .study-card #flashContent .back-example { font-size: 15px; margin-top: 5px; padding-top: 6px; }
  .study-card #flashContent .back-example-py,.study-card #flashContent .back-english { font-size: 10px; }
}
/* When the card is shorter than its content, safe centering prevents the
   beginning (word and pinyin) from being clipped above the scroll origin. */
.study-card #flashContent { justify-content: safe center; }
/* On a short screen, reserve more height for the actual word/answer. */
@media(max-width:700px) and (max-height:760px) {
  .flash-deck-note { display:none; }
}
