/* The word lists of the three notebooks: topics to filter by, then each word as a tile */

/* the topics: tap one to show only its words, tap it again (or Show all) to see every topic */
.wfilt {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.wfilt .wf {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-size: 0.86rem;
  color: inherit;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  transition:
    background-color 0.15s,
    border-color 0.15s;
}
/* hover colours only with a mouse: on a touch screen the last tile tapped kept its colour, like a second frame */
@media (hover: hover) {
  .wfilt .wf:hover {
    border-color: var(--ink-2);
  }
}
.wfilt .wf i {
  font: 500 0.72rem/1 var(--f-mono);
  font-style: normal;
  color: var(--ink-2);
}
.wfilt .wf[aria-pressed="true"] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  font-weight: 600;
}
.rposline {
  margin: -6px 0 0;
}

.wtiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6.2rem, 1fr));
  gap: 6px;
}
/* a word: small, like a kanji tile; tap it to see it large */
.wt {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 3px;
  min-width: 0;
  padding: 8px 4px 7px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--paper);
  color: inherit;
  font: inherit;
  text-align: center;
  cursor: pointer;
}
@media (hover: hover) {
  .wt:hover {
    border-color: var(--accent);
  }
}
/* the word open in the close-up is framed, and the frame moves as you swipe or step to the next word (like the kana
   chart), so after closing you can see where you were. */
.wt.sel {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}
.wt.sel:focus-visible {
  outline: 3px solid var(--mark);
  outline-offset: 2px;
}
.wt .w {
  font-size: 1.3rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.wt .w[lang="zh-Hans"] {
  font-size: 1.5rem;
  line-height: 1.2;
}
.wt .m {
  font-size: 0.72rem;
  line-height: 1.2;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.wt .tag {
  font-size: 0.6rem;
}
/* the word stays on one line: a long one (--n, its length) gets smaller to fit its card */
.wt,
.kt {
  container-type: inline-size;
}
.wt .w,
.kt [lang="ko"] {
  max-width: 100%;
  white-space: nowrap;
}
.wt .w[style] {
  font-size: min(1.3rem, calc(92cqi / var(--n, 1)));
}
.wt .w[lang="zh-Hans"][style] {
  font-size: min(1.5rem, calc(92cqi / var(--n, 1)));
}
.kt [lang="ko"][style] {
  font-size: min(2rem, calc(92cqi / var(--n, 1)));
}
.wgrid .kt [lang="ko"][style] {
  font-size: min(1.25rem, calc(92cqi / var(--n, 1)));
}
@media (max-width: 520px) {
  .wt .w[style] {
    font-size: min(1.15rem, calc(92cqi / var(--n, 1)));
  }
  .wt .w[lang="zh-Hans"][style] {
    font-size: min(1.35rem, calc(92cqi / var(--n, 1)));
  }
}
/* the progress bar sits at the bottom of every card, so a row of cards lines its bars up */
.wt,
.kgrid .kt {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.wt > .pip,
.kgrid .kt > .pip {
  margin-top: auto;
}
/* the level (N5, HSK 1) sits just above the bar, with it at the bottom of the card */
.wt > .tag,
.kgrid .kt > .tag {
  margin-top: auto;
}
.wt > .tag + .pip,
.kgrid .kt > .tag + .pip {
  margin-top: 4px;
}
/* the reading under the word, like a dictionary */
.wt .rd,
.wgrid .kt .rd {
  font-size: 0.7rem;
  line-height: 1.25;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
/* a topic left out of the practice set shows lighter */
.grp.off .wt {
  background: none;
}
.grp.off h3 {
  color: var(--ink-2);
}

/* the word opened large over the list */
.zword {
  display: grid;
  place-items: center;
  min-height: 9rem;
  padding: 10px 8px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--paper);
  font-size: clamp(2.8rem, 12vw, 3.6rem);
  line-height: 1.2;
  text-align: center;
  overflow-wrap: anywhere;
}
/* the zoomed word stays on one line: a long one (--n, its length) gets smaller to fit the box */
.zword {
  container-type: inline-size;
}
.zword > span {
  white-space: nowrap;
  font-size: min(1em, calc(88cqi / var(--n, 1)));
}
.zword > [lang="zh-Hans"] {
  font-size: min(1.2em, calc(88cqi / var(--n, 1)));
}
.zword .hc {
  font: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  /* each kanji / hanzi you can tap is in the accent colour, like a link */
  display: inline-block;
  margin: 0 0.04em;
  line-height: 1.15;
  color: var(--accent);
}
@media (hover: hover) {
  .zword .hc:hover {
    text-decoration: underline;
    text-decoration-thickness: 0.04em;
    text-underline-offset: 0.12em;
  }
}
.wzc .zr {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 4px 12px;
  font-size: 1.25rem;
}
.wzc .zr .rm,
.wzc .zr .py {
  font: 500 1.6rem/1.1 var(--f-mono);
}
.wzc .zr .py {
  font-family: var(--f-py, var(--f-body));
}
.zmean {
  max-width: 20rem;
  font-size: 1.05rem;
  line-height: 1.4;
  text-align: center;
}
/* the word close-up (its frame and top strip are every card's, css/shared/zoom.css): the level and topic in the strip,
   the word very large on a soft panel, the reading under it, then the meaning in its own block */
.wzc .zlv {
  flex: none;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font: 700 0.78rem/1 var(--f-body);
  letter-spacing: 0.02em;
}
.wzc .ztp {
  min-width: 0;
  font: 600 0.92rem/1.25 var(--f-body);
  color: var(--ink-2);
  text-align: left;
}
.zoom .wzc .zfig {
  grid-template-columns: minmax(0, 1fr);
  padding: 0 22px;
}
.wzc .zword {
  min-height: clamp(10rem, 28vh, 15rem);
  padding: 16px 12px;
  border: 0;
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 7%, var(--paper));
  font-size: clamp(3.4rem, 14vw, 6.2rem);
}
.wzc .zr {
  padding: 0 22px;
  font-size: 1.55rem;
}
.wzc .zr .rm {
  font-size: 1.35rem;
  color: var(--ink-2);
}
.wzc .zr .py {
  font-size: 2rem;
}
.wzc .zmean {
  width: calc(100% - 44px);
  max-width: 28rem;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  font-size: 1.35rem;
  font-weight: 500;
}
.wzc .meta {
  padding: 0 22px;
}
.wzc .acts {
  margin-top: 0;
}
@media (max-width: 520px) {
  .wzc .zword {
    min-height: 10rem;
  }
  .wzc .zmean {
    font-size: 1.2rem;
  }
}

@media (max-width: 520px) {
  .wfilt .wf {
    font-size: 0.8rem;
    padding: 5px 8px;
  }
  .wtiles {
    grid-template-columns: repeat(auto-fill, minmax(5rem, 1fr));
    gap: 5px;
  }
  .wt .w {
    font-size: 1.15rem;
  }
  .wt .w[lang="zh-Hans"] {
    font-size: 1.35rem;
  }
  .wt .m {
    font-size: 0.68rem;
  }
}

/* a long list: groups far from the screen are not laid out or painted until they come near. Only a height is
   kept for them: a width too would push the page wider than a phone. A group paints nothing past its own edge, so it
   gets 6px of room on every side (taken back by the margin, nothing moves): the 5px frame around the tile you were on
   stays whole in a group's first and last column and its bottom row. */
.grp {
  content-visibility: auto;
  contain-intrinsic-height: auto 40rem;
  padding: 6px;
  margin: -6px;
}
