/* The Chinese notebook (chinese.html and full/chinese-full.html), with the cut-down Kai font for the hanzi */

body {
  margin: 0;
}
img {
  max-width: 100%;
}
[hidden] {
  display: none !important;
}
.pq-gap {
  display: inline-block;
  min-width: 2.6em;
  height: 1em;
  border-bottom: 2px solid var(--accent);
  margin: 0 0.3em;
  vertical-align: -0.15em;
}

/* Kai: AR PL KaitiM GB (Arphic Public License), cut down to the characters this site uses; see fonts/make_kai.py */
@font-face {
  font-family: "Zhanote Kai";
  src: url(/fonts/zh-kai.woff2) format("woff2");
  font-display: swap;
}

/* Layout: a practice notebook, sibling of the kana one. Two steps on top (what to study, how to practise); one work
   sheet built around the red-lined rice-grid square used for hanzi practice; study set and progress in a side column
   that drops below the sheet on phones. Light theme is practice paper, dark theme is an ink stone. */
:root {
  --paper: #f2f3f6;
  --paper-line: #e6e8ee;
  --surface: #ffffff;
  --ink: #1a1d2b;
  --ink-2: #596074;
  --rule: #d6d9e2;
  --grid: #e2a49b;
  --grid-2: #f0d2cd;
  --accent: #1f4e9c;
  --on-accent: #ffffff;
  --mark: #f7d15e;
  --mark-ink: #1a1d2b;
  --mark-depth: 0.62em;
  --k1: #1d7a63;
  --k2: #b0306a;
  --k3: #9a5a00;
  --ok: #14734a;
  --ok-bg: #dcf1e5;
  --bad: #b4301f;
  --bad-bg: #fae2dd;
  --f-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", sans-serif;
  --f-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --f-py: "Noto Sans", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --f-han:
    "Zhanote Kai", "Kaiti SC", "STKaiti", "KaiTi", "楷体", "BiauKai", "AR PL UKai CN", "Songti SC", "Noto Serif CJK SC",
    "Noto Serif SC", "SimSun", serif;
}
:root[data-theme="dark"] {
  --paper: #131419;
  --paper-line: #191b22;
  --surface: #1c1e26;
  --ink: #eceae5;
  --ink-2: #a2a8b6;
  --rule: #2f333f;
  --grid: #7c4842;
  --grid-2: #4a2f2c;
  --accent: #9cc2ff;
  --on-accent: #0e1e3b;
  --mark: #e9c458;
  --mark-ink: #1b1a10;
  --mark-depth: 3px;
  --k1: #6fd0b4;
  --k2: #f29ac0;
  --k3: #f0b562;
  --ok: #74d6a4;
  --ok-bg: #1d3a2c;
  --bad: #f2958c;
  --bad-bg: #442521;
  color-scheme: dark;
}
:root[data-font="hei"] {
  --f-han:
    "PingFang SC", "Microsoft YaHei", "微软雅黑", "Noto Sans CJK SC", "Noto Sans SC", "Source Han Sans SC", "Heiti SC",
    sans-serif;
}
:root[data-font="song"] {
  --f-han: "Songti SC", "STSong", "SimSun", "宋体", "Noto Serif CJK SC", "Noto Serif SC", "Source Han Serif SC", serif;
}

* {
  box-sizing: border-box;
}
body {
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.5 var(--f-body);
  background-image:
    linear-gradient(var(--paper-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--paper-line) 1px, transparent 1px);
  background-size: 28px 28px;
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
h1,
h2,
h3,
h4,
p {
  margin: 0;
}
[lang="zh-Hans"] {
  font-family: var(--f-han);
}
.py {
  font-family: var(--f-py);
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.wrap {
  max-width: 70rem;
  margin-inline: auto;
  padding-inline: 16px;
  padding-block: 20px 56px;
  display: grid;
  gap: 20px;
}
.top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px 24px;
}
h1 {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  line-height: 1.1;
}
h1 [lang="zh-Hans"] {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}
h1 small {
  font: 600 0.8rem/1 var(--f-display);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.seg {
  display: inline-flex;
  flex-wrap: wrap;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
  padding: 3px;
  gap: 2px;
  max-width: 100%;
}
.seg button {
  padding: 6px 12px;
  border-radius: 5px;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--ink-2);
  white-space: nowrap;
}
.seg button[aria-pressed="true"] {
  background: var(--mark);
  color: var(--mark-ink);
}

.navrow {
  display: grid;
  grid-template-columns: 4.4rem minmax(0, 1fr);
  gap: 6px 12px;
  align-items: center;
}
.navlab {
  font: 600 0.72rem/1 var(--f-body);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.navmain {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  min-width: 0;
}
.subj {
  display: grid;
  /* one column per study button, however many there are */
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 5px;
  flex: 1 1 22rem;
  max-width: 44rem;
  min-width: 0;
}
.subj button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
  padding: 7px 6px;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink-2);
  min-height: 46px;
  min-width: 0;
}
.subj button [lang="zh-Hans"] {
  font-size: 1.35rem;
  line-height: 1;
  color: var(--ink);
  white-space: nowrap;
}
.subj button:hover {
  border-color: var(--ink-2);
}
.subj button[aria-pressed="true"] {
  background: var(--mark);
  border-color: var(--mark);
}
.subj button[aria-pressed="true"],
.subj button[aria-pressed="true"] [lang="zh-Hans"] {
  color: var(--mark-ink);
}
.lvl {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9rem;
}
.lvl {
  flex-wrap: wrap;
}
.lvl select {
  display: none !important;
}
.lvd {
  position: relative;
}
.lvd-b {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  max-width: 100%;
  padding: 0 12px 0 14px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  text-align: left;
}
.lvd-b small {
  font-weight: 500;
  color: var(--ink-2);
  font-size: 0.82rem;
}
.lvd-b svg {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--ink-2);
  transition: transform 0.15s;
}
.lvd.open .lvd-b {
  border-color: var(--accent);
}
.lvd.open .lvd-b svg {
  transform: rotate(180deg);
}
.lvd-b:focus-visible,
.lvd-i:focus-visible,
.lvd-all:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.lvd-m {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: min(340px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  padding: 6px;
}
.lvd-m[hidden] {
  display: none;
}
.lvd-i {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  text-align: left;
  cursor: pointer;
}
.lvd-i:hover {
  background: var(--paper);
}
.lvd-i b {
  font-weight: 600;
}
.lvd-i small {
  margin-left: auto;
  padding-left: 16px;
  color: var(--ink-2);
  font-size: 0.8rem;
  white-space: nowrap;
}
.lvd-i:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.lvd-x {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--ink-2);
  border-radius: 4px;
  flex: none;
  display: grid;
  place-items: center;
}
.lvd-i[aria-checked="true"] .lvd-x {
  background: var(--accent);
  border-color: var(--accent);
}
.lvd-i[aria-checked="true"] .lvd-x::after {
  content: "";
  width: 8px;
  height: 4px;
  border: 2px solid var(--on-accent);
  border-top: 0;
  border-right: 0;
  transform: translateY(-1px) rotate(-45deg);
}
.lvd-sep {
  height: 1px;
  background: var(--rule);
  margin: 6px 4px;
}
.lvd-all {
  display: block;
  width: calc(100% - 8px);
  margin: 2px 4px 4px;
  padding: 9px;
  border: 1px solid var(--rule);
  border-radius: 7px;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}
.lvd-all:disabled {
  opacity: 0.5;
  cursor: default;
}
.lvd-no {
  animation: lvdno 0.3s;
}
@keyframes lvdno {
  25% {
    transform: translateX(-3px);
  }
  75% {
    transform: translateX(3px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .lvd-no {
    animation: none;
  }
  .lvd-b svg {
    transition: none;
  }
}
.lvl select {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0 10px;
  min-height: 46px;
  cursor: pointer;
}
/* the Practise row sits close under the Study row */
.navrow + .navrow {
  margin-top: -10px;
}
.tabs {
  display: grid;
  grid-template-columns: repeat(var(--n, 6), minmax(0, var(--bw, 7rem)));
  gap: 5px;
}
.tabs button {
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
  padding: 9px 4px;
  font: 600 0.98rem/1.2 var(--f-display);
  color: var(--ink-2);
  min-width: 0;
  white-space: nowrap;
  /* as tall as the Study buttons above, so the two rows line up */
  min-height: 46px;
}
.tabs button:hover {
  border-color: var(--ink-2);
}
.tabs button[aria-current="page"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.subj button,
.tabs button,
.pad {
  user-select: none;
  -webkit-user-select: none;
}

.kword {
  font-size: clamp(2.4rem, 11vw, 3.6rem);
  line-height: 1.15;
}
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18.5rem;
  gap: 28px;
  align-items: start;
}
/* a reference page (a chart, the radicals, the word list) takes the whole width, without the side column */
.layout.wide {
  grid-template-columns: minmax(0, 1fr);
}
.layout.wide .side {
  display: none;
}
.layout.wide .head p {
  max-width: 56rem;
}
.sheet {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 22px;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  scroll-margin-top: 5.5rem;
}
.head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  align-items: flex-end;
  justify-content: space-between;
}
.head h2 {
  font: 700 1.35rem/1.2 var(--f-display);
  text-wrap: balance;
}
.head p {
  color: var(--ink-2);
  font-size: 0.92rem;
  max-width: 34rem;
}
.head-r {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
}
.stack {
  display: grid;
  gap: 22px;
}
.full {
  width: 100%;
}

/* practice square: the rice-grid box of a hanzi workbook, with cross and diagonal guides */
.sq {
  position: relative;
  width: min(100%, 14.5rem);
  aspect-ratio: 1;
  container-type: inline-size;
  border: 1.5px solid var(--grid);
  border-radius: 4px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(90deg, var(--grid) 50%, transparent 0) center/10px 1px repeat-x,
    linear-gradient(0deg, var(--grid) 50%, transparent 0) center/1px 10px repeat-y,
    var(--surface);
}
.sq .g {
  font-size: 9rem;
  font-size: 66cqi;
  line-height: 1;
  font-weight: 400;
}
.sq .mt {
  font: 600 1.2rem/1.25 var(--f-display);
  font-size: 9.5cqi;
  padding: 8%;
  text-align: center;
  text-wrap: balance;
}
.sq .corner,
.pcard .corner {
  position: absolute;
  top: 6px;
  left: 8px;
  font: 500 0.72rem/1 var(--f-body);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.card {
  cursor: pointer;
}

.drill {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  gap: 18px;
  width: 100%;
  max-width: 28rem;
  margin-inline: auto;
  text-align: center;
}
.ask {
  font-weight: 500;
  font-size: 1.05rem;
}
.meta {
  color: var(--ink-2);
  font-size: 0.88rem;
}
.acts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
  font-weight: 600;
  font-size: 0.95rem;
  min-height: 42px;
}
.btn:hover {
  border-color: var(--ink-2);
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.btn.good {
  border-color: var(--ok);
  color: var(--ok);
  background: var(--ok-bg);
}
.btn.miss {
  border-color: var(--bad);
  color: var(--bad);
  background: var(--bad-bg);
}
.btn svg {
  width: 17px;
  height: 17px;
  flex: none;
}
.btn.ic {
  padding: 8px;
  min-height: 38px;
  min-width: 38px;
  justify-content: center;
}
kbd {
  font: 500 0.72rem/1 var(--f-mono);
  border: 1px solid currentColor;
  border-radius: 4px;
  padding: 2px 5px;
  opacity: 0.6;
}
.tag {
  font: 600 0.7rem/1 var(--f-body);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.hl {
  padding-inline: 4px;
  font-weight: 600;
  box-shadow: inset 0 calc(-1 * var(--mark-depth)) 0 var(--mark);
}
.tlnk {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-align: left;
}
.sub {
  font: 600 0.72rem/1 var(--f-body);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-top: 4px;
}

.opts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}
.opt {
  position: relative;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
  min-height: 4.2rem;
  padding: 10px 8px;
  font: 500 1rem/1.25 var(--f-body);
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
}
.opt.zh {
  font: 400 2.1rem/1.15 var(--f-han);
}
.opt.pyo {
  font: 500 1.3rem/1.2 var(--f-py);
}
.opt small {
  font: 400 0.8rem/1 var(--f-py);
  color: var(--ink-2);
}
.opt kbd {
  position: absolute;
  top: 6px;
  left: 7px;
}
.opt {
  padding-left: 28px;
  padding-right: 28px;
  overflow-wrap: anywhere;
}
@media (hover: none) and (pointer: coarse) {
  .opt kbd {
    display: none;
  }
  .opt {
    padding-left: 10px;
    padding-right: 10px;
  }
}
.opt:hover:not(:disabled) {
  border-color: var(--accent);
}
.opt:disabled {
  cursor: default;
}
.opt.right {
  background: var(--ok-bg);
  border-color: var(--ok);
  color: var(--ok);
}
.opt.wrong {
  background: var(--bad-bg);
  border-color: var(--bad);
  color: var(--bad);
}
.opt.dim {
  opacity: 0.45;
}

.fb {
  min-height: 2.9rem;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 500;
}
.fb.ok {
  background: var(--ok-bg);
  color: var(--ok);
}
.fb.no {
  background: var(--bad-bg);
  color: var(--bad);
}
.fb .m {
  font-size: 1.5rem;
  line-height: 1;
  font-weight: 700;
}
.fb [lang="zh-Hans"] {
  font-size: 1.25em;
}
.fb small {
  display: block;
  font-size: 0.82rem;
  font-weight: 400;
  opacity: 0.9;
  margin-top: 2px;
}

.tform {
  display: flex;
  gap: 8px;
  width: 100%;
}
.tform input {
  flex: 1;
  min-width: 0;
  border: 1.5px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px 14px;
  font: 500 1.25rem/1.2 var(--f-py);
  text-align: center;
}
.tform input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.tform input.ok {
  border-color: var(--ok);
  background: var(--ok-bg);
}
.tform input.no {
  border-color: var(--bad);
  background: var(--bad-bg);
}
.tp-prompt {
  display: grid;
  gap: 12px;
  justify-items: center;
  width: 100%;
}
.bigw {
  font-size: clamp(2.6rem, 12vw, 4rem);
  line-height: 1.15;
}
.mean {
  font: 600 1.1rem/1.3 var(--f-display);
}

.pad svg#pad {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}
.pad #pad path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sq.pad {
  width: min(100%, 19rem);
}
.pad .so {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.pad.noguide .so {
  visibility: hidden;
}

.empty {
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
  padding-block: 36px;
  color: var(--ink-2);
}
.empty b {
  font: 700 1.15rem/1.3 var(--f-display);
  color: var(--ink);
}

/* pinyin chart */
.grp {
  display: grid;
  gap: 10px;
}
.grp h3 {
  font: 700 1rem/1.2 var(--f-display);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: baseline;
}
.grp h3 small {
  font: 400 0.85rem/1.2 var(--f-body);
  color: var(--ink-2);
}
.prow {
  display: grid;
  grid-template-columns: 10.5rem minmax(0, 1fr);
  gap: 6px 12px;
  align-items: center;
}
.prow > span {
  font-size: 0.86rem;
  color: var(--ink-2);
}
.pcs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.pc {
  min-width: 3.2rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--paper);
  padding: 7px 8px;
  font: 500 1.15rem/1.2 var(--f-py);
}
@media (hover: hover) {
  .pc:hover {
    border-color: var(--accent);
  }
}
.pc.sel {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  background: var(--surface);
}
.tones {
  width: 100%;
  max-width: 30rem;
  height: auto;
  display: block;
}
.tones text {
  font: 500 11px var(--f-body);
  fill: var(--ink-2);
}
.tones .tl {
  font: 600 13px var(--f-py);
  fill: var(--ink);
}
.tones .td,
.tones .tc {
  font: 500 10px var(--f-mono);
  fill: var(--ink-2);
}
.tones .tone {
  cursor: pointer;
  outline: none;
}
.tones .hit {
  fill: transparent;
  stroke: transparent;
  stroke-width: 1.5;
}
.tones .tone:hover .hit {
  fill: var(--surface);
}
.tones .tone:focus-visible .hit {
  stroke: var(--accent);
}
.tones .tp {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: miter;
  stroke-miterlimit: 8;
}
.tones .tone.go .hit {
  fill: var(--surface);
}
@media (prefers-reduced-motion: no-preference) {
  .tones .tone.go .tp {
    stroke-dasharray: 1 1;
    animation: tdraw 0.75s ease-out both;
  }
}
@keyframes tdraw {
  from {
    stroke-dashoffset: 1;
  }
  to {
    stroke-dashoffset: 0;
  }
}

/* stroke order */
.kvg {
  display: block;
}
.sq .kvg {
  position: absolute;
  inset: 4%;
  width: 92%;
  height: 92%;
}
.kvg path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 3.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.kvg text {
  font: 500 6.5px var(--f-mono);
  fill: var(--accent);
}
.kvg.faint path {
  stroke: var(--grid);
}
.kvg.faint text {
  fill: var(--ink-2);
}
.kvg.guide path {
  stroke: var(--accent);
  opacity: 0.5;
}
@media (prefers-reduced-motion: no-preference) {
  /* each stroke at one steady speed: js/shared/strokes.js sets when it starts (--t) and how long it takes (--d) from
     its length; the even rhythm below is only for a drawing it has not timed */
  .kvg.play path {
    stroke-dasharray: 1 3;
    stroke-dashoffset: 1.05;
    animation: kdraw var(--d, 0.5s) ease-in-out forwards;
    animation-delay: var(--t, calc(var(--i) * 0.62s));
  }
  .kvg.play text {
    opacity: 0;
    animation: kshow 0.1s linear forwards;
    animation-delay: var(--t, calc(var(--i) * 0.62s));
  }
}
@keyframes kdraw {
  to {
    stroke-dashoffset: 0;
  }
}
@keyframes kshow {
  to {
    opacity: 1;
  }
}

/* hanzi and words */
.kgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.3rem, 1fr));
  gap: 6px;
}
.kt {
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 7px 3px 7px;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 2px;
  background: var(--paper);
  min-width: 0;
}
.kt [lang="zh-Hans"] {
  font-size: 2rem;
  line-height: 1.15;
}
.kt small {
  font: 400 0.76rem/1.2 var(--f-py);
  color: var(--ink-2);
  text-align: center;
  overflow-wrap: anywhere;
}
@media (hover: hover) {
  .kt:hover {
    border-color: var(--accent);
  }
}
.kt.off {
  background: none;
}
.pip {
  display: block;
  width: 1.1rem;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--pc, var(--ok)) calc(var(--n) * 16.67%), var(--rule) 0);
}
.pip.due {
  --pc: var(--accent);
}
.kd {
  display: grid;
  gap: 22px;
}
.kd-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  justify-content: space-between;
}
.kd-nav .btn {
  min-height: 38px;
  padding: 6px 12px;
}
.kd-top {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}
.kd-fig {
  display: grid;
  gap: 10px;
  justify-items: center;
}
.kd-fig .sq {
  width: 100%;
}
.kd-info {
  display: grid;
  gap: 14px;
  min-width: 0;
}
.kd-py {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  align-items: center;
  font: 600 1.9rem/1.1 var(--f-py);
}
.kd-mean {
  font: 700 1.3rem/1.25 var(--f-display);
  text-wrap: balance;
}
.hint {
  background: var(--paper);
  border-radius: 8px;
  padding: 10px 14px;
  display: grid;
  gap: 5px;
}
.hint .sub {
  margin: 0;
}
.hc {
  font: inherit;
  /* a hanzi you can tap is in the accent colour, like a link */
  color: var(--accent);
  padding: 0 1px;
  border-radius: 3px;
}
@media (hover: hover) {
  .hc:hover {
    text-decoration: underline;
    text-underline-offset: 0.15em;
  }
}
.wl {
  border-top: 1px solid var(--rule);
}
/* the rows share one set of columns, so a long word (赤ちゃん) does not push its reading and meaning out of line
   with the others: the word column is as wide as the widest word in the list */
@supports (grid-template-columns: subgrid) {
  .wl {
    display: grid;
    grid-template-columns: minmax(4.2rem, max-content) minmax(0, 1fr) auto auto;
  }
  .wl > .wr {
    grid-column: 1 / -1;
    grid-template-columns: subgrid;
  }
}
.wr {
  display: grid;
  grid-template-columns: minmax(4.2rem, auto) minmax(0, 1fr) auto auto;
  gap: 6px 14px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--rule);
}
.wr .w {
  font-size: 1.5rem;
  line-height: 1.2;
  white-space: nowrap;
}
.wr .w b,
.wr .k0 {
  /* the hanzi this page is about in the theme colour; every other hanzi in a colour of its own, and its syllable of
     the pinyin in the same colour */
  font-weight: inherit;
  color: var(--accent);
}
.wr .k1 {
  color: var(--k1);
}
.wr .k2 {
  color: var(--k2);
}
.wr .k3 {
  color: var(--k3);
}
.wd {
  min-width: 0;
  line-height: 1.35;
}
.wd .py {
  font-size: 1.02rem;
}
.find {
  width: 100%;
  max-width: 24rem;
  border: 1.5px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
  padding: 9px 12px;
}
.pcard {
  position: relative;
  width: 100%;
  min-height: 11rem;
  border: 1.5px solid var(--grid);
  border-radius: 8px;
  background: var(--surface);
  padding: 30px 16px 22px;
  display: grid;
  gap: 8px;
  justify-items: center;
  align-content: center;
  cursor: pointer;
}
.pcard .pj {
  font-size: 2.6rem;
  line-height: 1.25;
}
.pcard .pj.long {
  font-size: 1.75rem;
  line-height: 1.4;
}
.pcard .py {
  font-size: 1.15rem;
}

/* grammar */
.ex {
  position: relative;
  display: grid;
  gap: 2px;
  padding: 10px 54px 10px 14px;
  background: var(--paper);
  border-radius: 8px;
  text-align: left;
  min-width: 0;
}
.ex-j {
  font-size: 1.45rem;
  line-height: 1.45;
}
.ex.big .ex-j {
  font-size: 1.75rem;
}
.pt.fill {
  background: var(--mark);
  color: var(--mark-ink);
  border-radius: 3px;
  padding-inline: 3px;
  font-weight: inherit;
}
.blank {
  display: inline-block;
  width: 1.6em;
  height: 1.05em;
  vertical-align: -0.15em;
  border-bottom: 2px solid var(--accent);
  margin-inline: 3px;
}
.ex-e {
  font-size: 0.96rem;
}
.ex .btn.ic {
  position: absolute;
  top: 8px;
  right: 8px;
}
.lesson {
  display: grid;
  gap: 14px;
  max-width: 46rem;
  min-width: 0;
}
.lesson h3 {
  font: 700 1.4rem/1.25 var(--f-display);
  text-wrap: balance;
}
.lesson h4 {
  font: 700 1.08rem/1.3 var(--f-display);
  margin: 10px 0 0;
}
.lesson p {
  max-width: 68ch;
}
.pat {
  border: 1.5px solid var(--grid);
  border-radius: 6px;
  padding: 9px 14px;
  font-weight: 600;
  font-size: 1.05rem;
}
.pat [lang="zh-Hans"] {
  font-size: 1.25em;
  color: var(--accent);
}
.tw {
  overflow-x: auto;
}
.gt {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
}
.gt th,
.gt td {
  border: 1px solid var(--rule);
  padding: 7px 10px;
  text-align: left;
  vertical-align: middle;
}
.gt th {
  background: var(--paper);
  font-weight: 600;
  font-size: 0.86rem;
}
.jw [lang="zh-Hans"] {
  font-size: 1.2em;
}
.llist {
  display: grid;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.lrow {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface);
}
.lrow:hover {
  border-color: var(--accent);
}
.lrow .n {
  font: 500 0.92rem/1 var(--f-mono);
  color: var(--ink-2);
}
.lrow b {
  display: block;
  font: 700 1.02rem/1.3 var(--f-display);
}
.lrow small {
  color: var(--ink-2);
  font-size: 0.86rem;
  line-height: 1.35;
  display: block;
}
.lrow .done {
  color: var(--ok);
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
}
.tile [lang="zh-Hans"] {
  font-size: 1.5rem;
  line-height: 1.2;
}
.tile small {
  font: 400 0.74rem/1.1 var(--f-py);
  color: var(--ink-2);
}

/* side column */
.side {
  display: grid;
  gap: 22px;
  min-width: 0;
}
.side section {
  display: grid;
  gap: 10px;
}
.side h2 {
  font: 700 1rem/1.2 var(--f-display);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.side h2 small {
  font: 500 0.82rem/1 var(--f-mono);
  color: var(--ink-2);
}
.side section + section {
  border-top: 1px solid var(--rule);
  padding-top: 20px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.chip {
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
  padding: 4px 8px;
  font: 500 0.8rem/1.3 var(--f-mono);
  color: var(--ink-2);
  display: inline-flex;
  gap: 5px;
  align-items: baseline;
}
.chip [lang="zh-Hans"] {
  font-size: 1rem;
  color: var(--ink);
}
.chip[aria-pressed="true"] {
  background: var(--mark);
  border-color: var(--mark);
  color: var(--mark-ink);
}
.chip[aria-pressed="true"] [lang="zh-Hans"] {
  color: var(--mark-ink);
}
.chip span.n {
  opacity: 0.7;
}
.mini {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.mini button {
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.84rem;
  font-weight: 600;
  background: var(--surface);
}
.mini button:hover {
  border-color: var(--ink-2);
}
.bar {
  display: flex;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  background: var(--rule);
}
.bar i {
  display: block;
}
.bar .b3 {
  background: var(--ok);
}
.legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  font-size: 0.84rem;
  color: var(--ink-2);
}
.legend b {
  display: block;
  font: 500 1.25rem/1.2 var(--f-mono);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.legend span::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 6px;
  background: var(--rule);
}
.legend .l1::before {
  background: var(--mark);
}
.by-credits {
  color: inherit;
}

/* up to a tablet held sideways (1100px) the study set and progress go under the card, which takes the whole width,
   so the study and practise buttons above line up with it and keep room for their labels */
@media (max-width: 1100px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 640px) {
  .kd-top {
    grid-template-columns: minmax(0, 1fr);
  }
  .kd-fig .sq {
    width: min(100%, 15rem);
  }
  .prow {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 600px) {
  .navrow {
    grid-template-columns: minmax(0, 1fr);
  }
  .subj {
    flex-basis: 100%;
    max-width: none;
  }
  .subj button {
    flex-direction: column;
    gap: 4px;
    /* the largest text sizes on a narrow phone: no bigger than fits the button (Grammar, Syllables) */
    font-size: min(0.8rem, 3.9vw);
    padding: 7px 2px 6px;
  }
  .tabs button {
    min-height: 0;
    /* the largest text sizes on a narrow phone: no bigger than fits the button (Radicals, Look-alikes) */
    font-size: min(0.86rem, 4.6vw);
    padding: 10px 1px;
  }
}
@media (max-width: 480px) {
  .seg button {
    padding: 6px 9px;
    font-size: 0.85rem;
  }
  .sheet {
    padding: 16px 12px;
  }
  h1 [lang="zh-Hans"] {
    font-size: 1.7rem;
  }
  .wr {
    gap: 6px 10px;
  }
  .wr .w {
    font-size: 1.35rem;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .btn,
  .opt,
  .chip,
  .kt,
  .pc,
  .tile {
    transition:
      border-color 0.12s,
      background-color 0.12s;
  }
}

/* syllable recordings */
.sytab {
  display: grid;
  gap: 6px;
  max-height: 19.5rem;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--paper);
}
.syrow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.sy {
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
  padding: 9px 4px;
  min-height: 42px;
  font: 500 1.1rem/1.2 var(--f-py);
  text-align: center;
}
.sy:hover {
  border-color: var(--accent);
}
.sy:active,
.btn[data-act="syl"]:active {
  background: var(--mark);
  color: var(--mark-ink);
}
.btn.pyb {
  font: 600 1.15rem/1.2 var(--f-py);
}
.kd-py .btn.ic {
  position: static;
}

.byline {
  margin: 0;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  text-align: center;
  font-size: 0.92rem;
  color: var(--ink-2);
  letter-spacing: 0.02em;
}
.byline b {
  font: 700 1.05rem/1 var(--f-display);
  color: var(--ink);
  letter-spacing: 0;
}

/* vocab list, zoomed chart view and ranks (shared with the kana notebook) */

.vcat {
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
}
.vcat summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: center;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}
.vcat summary::-webkit-details-marker {
  display: none;
}
.vcat .vn {
  font: 600 1.02rem/1.2 var(--f-display);
}
.vcat .vc {
  font: 500 0.84rem/1 var(--f-mono);
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.vcat .vc.done {
  color: var(--ok);
}
.vcat summary .bar {
  grid-column: 1/-1;
  height: 6px;
}
.vt {
  position: relative;
  display: grid;
  gap: 2px;
  align-content: start;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--paper);
  padding: 10px 10px 9px;
  min-width: 0;
}
.vt .k {
  font-size: 1.3rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
  padding-right: 1.6rem;
}
.vt .m {
  font-size: 0.86rem;
  line-height: 1.3;
}
.vt .vx {
  position: absolute;
  top: 7px;
  right: 8px;
  font: 500 0.72rem/1 var(--f-mono);
  color: var(--bad);
}
.vt.lock {
  border-style: dashed;
  background: none;
  color: var(--ink-2);
  font-size: 0.86rem;
  place-content: center;
  text-align: center;
  min-height: 4.6rem;
}

.zoom {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(10, 16, 14, 0.55);
  overscroll-behavior: contain;
}
.zcard {
  width: min(100%, 24rem);
  max-height: 100%;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 12px 16px 18px;
  display: grid;
  gap: 8px;
  justify-items: center;
  text-align: center;
  outline: none;
}
.zoom.in {
  animation: zfade 0.2s ease-out;
}
.zoom.in .zcard {
  animation: zin 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes zfade {
  from {
    background: rgba(10, 16, 14, 0);
  }
}
@keyframes zin {
  from {
    transform: translate(var(--dx), var(--dy)) scale(0.16);
    opacity: 0.4;
  }
}
@media (prefers-reduced-motion: reduce) {
  .zoom.in,
  .zoom.in .zcard {
    animation: none;
  }
}
.zbar {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.znav:hover {
  border-color: var(--ink-2);
  color: var(--ink);
}
.zfig {
  display: grid;
  grid-template-columns: auto minmax(0, 13rem) auto;
  gap: 8px;
  align-items: center;
  justify-content: center;
  width: 100%;
}
.zfig .sq {
  width: 100%;
}
.znav {
  font-size: 1.9rem;
  line-height: 1;
  width: 2.6rem;
  height: 3.6rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink-2);
}
.zcard .meta {
  max-width: 20rem;
}
.zcard .acts {
  margin-top: 6px;
}

.rankbox {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-left: 5px solid var(--rc, var(--rule));
  border-radius: 8px;
  background: var(--surface);
}
.rankbox span {
  font: 600 0.72rem/1 var(--f-body);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.rankbox b {
  font: 700 1.6rem/1.15 var(--f-display);
}
.rankbox small {
  font-size: 0.86rem;
  color: var(--ink-2);
}
.rankbox.r1,
.bar .r1,
.legend .r1 {
  --rc: var(--mark);
}
.rankbox.r2,
.bar .r2,
.legend .r2 {
  --rc: #e8964a;
}
.rankbox.r3,
.bar .r3,
.legend .r3 {
  --rc: var(--accent);
}
.rankbox.r4,
.bar .r4,
.legend .r4 {
  --rc: var(--ok);
}
.bar .r1,
.bar .r2,
.bar .r3,
.bar .r4 {
  background: var(--rc);
}
.legend.rk {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 10px;
}
.legend.rk span::before {
  background: var(--rc, var(--rule));
}

.vt .k {
  font-family: var(--f-han);
}
.vt .py {
  font-size: 0.86rem;
  color: var(--ink-2);
}
.zcard.pz {
  width: min(100%, 27rem);
  text-align: left;
  justify-items: stretch;
}
.zcard.pz > p {
  text-align: center;
}
.pzbig {
  font: 600 4.2rem/1 var(--f-py);
  text-align: center;
  padding: 18px 8px;
  border: 1.5px solid var(--grid);
  border-radius: 8px;
  background: var(--paper);
}
/* the group's -6px margin (words.css) would push it past the card's sides; its side padding is the card's (zoom.css).
   With the group's 6px padding the content still starts 6px down. */
.zcard.pz .grp {
  margin: 0 0 -6px;
}
.zcard.pz .sytab {
  max-height: none;
}

/* writing flashcards: your writing beside the real one */
.cmp {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  max-width: 26rem;
  margin: 0 auto;
}
.cmp figure {
  margin: 0;
  display: grid;
  gap: 6px;
  justify-items: center;
}
.cmp .sq {
  width: 100%;
}
.cmp figcaption {
  font-size: 0.86rem;
  color: var(--ink-2);
}
.pad.mine {
  display: grid;
  place-items: center;
}
.pad.mine svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.pad.mine path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pad .corner {
  z-index: 1;
}
.kans {
  display: grid;
  gap: 6px;
  justify-items: center;
}
.sq.wide {
  aspect-ratio: var(--n) / 1;
  width: min(100%, calc(var(--n) * 9.5rem));
}
.cmp.wide {
  grid-template-columns: minmax(0, 1fr);
  max-width: calc(var(--n) * 9.5rem);
}
.so.row {
  display: flex;
}
.so.row .so1 {
  position: relative;
  flex: 1;
}
.so.row .so1 .kvg {
  position: absolute;
  inset: 4%;
  width: 92%;
  height: 92%;
}

/* radicals */
.p-h {
  --pc: #d3e5ff;
}
.p-t {
  --pc: #fad1e3;
}
.p-k {
  --pc: #cdefe3;
}
.p-a {
  --pc: #ffddbf;
}
.p-r {
  --pc: #e6d5f8;
}
.p-n {
  --pc: #e6f4c4;
}
.p-m {
  --pc: #f1e2c6;
}
.p-x {
  --pc: #e6e6e6;
}
:root[data-theme="dark"] .p-h {
  --pc: #23395c;
}
:root[data-theme="dark"] .p-t {
  --pc: #5a2440;
}
:root[data-theme="dark"] .p-k {
  --pc: #1f4a3d;
}
:root[data-theme="dark"] .p-a {
  --pc: #5a3a1c;
}
:root[data-theme="dark"] .p-r {
  --pc: #4a3566;
}
:root[data-theme="dark"] .p-n {
  --pc: #3b4a1e;
}
:root[data-theme="dark"] .p-m {
  --pc: #4a3e2a;
}
:root[data-theme="dark"] .p-x {
  --pc: #3a3a3a;
}
.rgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.6rem, 1fr));
  gap: 6px;
}
/* a radical tile: the count in its own strip at the top, then the same rows in every tile (forms, Chinese name, pinyin, meaning)
   so a row of tiles lines up */
.rt {
  position: relative;
  container-type: inline-size;
  display: grid;
  justify-items: stretch;
  align-content: start;
  gap: 2px;
  min-width: 0;
  padding: 17px 4px 7px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--pc);
  color: var(--ink);
  font: inherit;
  text-align: center;
}
@media (hover: hover) {
  .rt:hover {
    border-color: var(--ink-2);
  }
}
.rt.back {
  outline: 3px solid var(--mark);
  outline-offset: 2px;
}
/* its forms (人 亻) side by side, centred across the whole tile; two or three get smaller only when the tile is narrow */
.rt .rg {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0 0.22em;
  min-width: 0;
  min-height: 2.04rem;
  font-size: 1.7rem;
  line-height: 1.2;
  white-space: nowrap;
}
.rt .rg.n2 {
  font-size: min(1.7rem, calc((100cqi - 12px) / 2.4));
}
.rt .rg.n3 {
  font-size: min(1.7rem, calc((100cqi - 12px) / 3.8));
}
/* the name on one line, smaller when it is long (--n, its length) */
.rt .rn {
  font-size: min(0.8rem, calc(96cqi / var(--n, 1)));
  line-height: 1.25;
  white-space: nowrap;
}
/* the pinyin of the name, on its own line */
.rt .rpy {
  font: 400 min(0.78rem, calc(150cqi / var(--n, 1)))/1.25 var(--f-py);
  color: var(--ink-2);
  white-space: nowrap;
}
/* the meaning: room for two lines in every tile */
.rt small {
  min-height: calc(2 * 1.2em);
  font-size: 0.72rem;
  line-height: 1.2;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.rt .rc {
  position: absolute;
  top: 4px;
  right: 6px;
  font: 500 0.68rem/1 var(--f-mono);
  font-style: normal;
  color: var(--ink-2);
}

.rlegend2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 6px 10px;
  font-size: 0.84rem;
}
.rp {
  display: flex;
  align-items: center;
  gap: 7px;
}
.rp small {
  color: var(--ink-2);
}
svg.pos {
  flex: none;
  width: 1.4rem;
  height: 1.4rem;
}
svg.pos > * {
  fill: var(--pc);
  stroke: var(--ink-2);
  stroke-width: 0.8;
}
svg.pos .pf {
  fill: none;
  stroke: var(--rule);
}
.rmore summary {
  grid-template-columns: minmax(0, 1fr) auto;
}
.rmore .rgrid {
  padding: 2px 14px 14px;
}
.rforms {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 10px;
}
.rform {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 12px 10px;
  border-radius: 10px;
  background: var(--pc);
  text-align: center;
}
.rform .rg {
  font-size: 3.6rem;
  line-height: 1.1;
}
.rform p {
  margin: 0;
}
.rform .btn.ic {
  position: absolute;
  top: 6px;
  right: 6px;
}
.rwhere {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  color: var(--ink-2);
}
.radbox {
  display: grid;
  gap: 6px;
}
.rchip {
  display: flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  max-width: 100%;
  padding: 8px 14px 8px 10px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--pc);
  color: var(--ink);
  text-align: left;
  font: inherit;
  line-height: 1.3;
}
.rchip .rg {
  font-size: 2rem;
  line-height: 1;
}
.rchip small {
  color: var(--ink-2);
}
.rchip:hover {
  border-color: var(--ink-2);
}

svg.pos .pf {
  fill: var(--surface) !important;
  stroke: var(--ink-2) !important;
}
.rform svg.pos,
.rchip svg.pos {
  width: 1.6rem;
  height: 1.6rem;
}
.kt .kr {
  font: 500 0.82rem/1.2 var(--f-py);
  color: var(--accent);
}
.kt .km {
  font-size: 0.7rem;
}
.rform .py,
.rchip .py {
  font: 400 0.78rem/1.2 var(--f-py);
  color: var(--ink-2);
}
.rmore {
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--surface);
}
.rmore summary {
  display: flex;
  justify-content: space-between;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 600;
}

.rlegend2 .rp {
  font: inherit;
  color: inherit;
  text-align: left;
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 5px 7px;
  cursor: pointer;
  transition:
    background-color 0.15s,
    border-color 0.15s;
}
.rlegend2 .rp:hover {
  border-color: var(--rule);
  background: var(--surface);
}
.rlegend2 .rp[aria-pressed="true"] {
  border-color: var(--ink-2);
  background: var(--pc);
}
.rlegend2 .rp > span {
  flex: 1;
}
.rpn {
  font: 500 0.72rem/1 var(--f-mono);
  font-style: normal;
  color: var(--ink-2);
}
.rposline {
  margin: -6px 0 0;
}

/* ---------- practice tabs on narrow phones: 5 or 6 tabs go in two rows of 3, 7 tabs in rows of 4 and 3 ---------- */
@media (max-width: 420px) {
  .tabs[style*="--n: 5"],
  .tabs[style*="--n: 6"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .tabs[style*="--n: 7"] {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 340px) {
  .tabs[style*="--n: 4"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
/* radical tiles on a phone: slightly smaller forms */
@media (max-width: 420px) {
  .rt .rg {
    font-size: 1.5rem;
    min-height: 1.8rem;
  }
  .rt .rg.n2 {
    font-size: min(1.5rem, calc((100cqi - 12px) / 2.4));
  }
  .rt .rg.n3 {
    font-size: min(1.5rem, calc((100cqi - 12px) / 3.8));
  }
}
/* ---------- site bar: brand, study-language menu, and the menu for the language of the explanations ---------- */
.sitebar {
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  position: relative;
  z-index: 30;
}
.sb-in {
  max-width: 70rem;
  margin-inline: auto;
  padding: 9px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.sb-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  font: 700 1.02rem/1.1 var(--f-display);
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.005em;
}
.sb-mark {
  flex: none;
  width: 1.9rem;
  height: 1.9rem;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--accent);
  color: var(--on-accent);
  font: 600 1.05rem/1 var(--f-body);
}
.sb-nav {
  display: flex;
  gap: 6px;
  flex: none;
}
.sb-dd {
  position: relative;
}
.sb-dd summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--paper);
  font: 600 0.9rem/1 var(--f-body);
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}
.sb-dd summary::-webkit-details-marker {
  display: none;
}
.sb-dd summary:hover,
.sb-dd[open] summary {
  border-color: var(--ink-2);
}
.sb-c {
  font-size: 0.7rem;
  color: var(--ink-2);
  transition: transform 0.12s;
}
.sb-dd[open] .sb-c {
  transform: rotate(180deg);
}
.flag {
  flex: none;
  width: 24px;
  height: 16px;
  border-radius: 3px;
  box-shadow: 0 0 0 1px var(--rule);
}
.flag.globe {
  box-shadow: none;
  color: var(--ink-2);
}
.sb-menu::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -8px;
  height: 8px;
}
.sb-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 14.5rem;
  padding: 6px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(10, 16, 14, 0.18);
  display: grid;
  gap: 2px;
}
.sb-h {
  margin: 0;
  padding: 6px 8px 4px;
  font: 600 0.7rem/1 var(--f-body);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.sb-i {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 8px;
  border-radius: 7px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.2;
}
.sb-i small {
  display: block;
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--ink-2);
  margin-top: 1px;
}
a.sb-i:hover {
  background: var(--paper);
}
.sb-i.cur {
  background: var(--paper);
}
button.sb-i {
  width: 100%;
  text-align: left;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  border: 0;
  background: none;
  cursor: pointer;
}
button.sb-i:hover {
  background: var(--paper);
}
.sb-i:not(.cur) .sb-tick {
  visibility: hidden;
}
.sb-tick {
  color: var(--ok, #14734a);
  font-size: 0.9rem;
}
.sw {
  display: inline-flex;
  flex: none;
}
.sw i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: 0 0 0 1.5px var(--surface);
  margin-left: -4px;
}
.sw i:first-child {
  margin-left: 0;
  box-shadow: 0 0 0 1px var(--rule);
}
@media (max-width: 30rem) {
  .sb-brand > span:last-child {
    display: none;
  }
  .sb-nav {
    gap: 5px;
  }
}
.sb-sep {
  height: 1px;
  background: var(--rule);
  margin: 4px 2px;
}
@media (max-width: 30rem) {
  .sb-brand {
    font-size: 0.95rem;
  }
  .sb-dd summary {
    padding: 0 8px;
    gap: 6px;
  }
}
/* small screens: the menus open under the whole bar, inside the screen, instead of hanging off the button */
@media (max-width: 26rem) {
  .sb-name {
    display: none;
  }
  .sb-in {
    padding-inline: 12px;
    gap: 6px;
  }
}
@media (max-width: 40rem) {
  .sb-dd {
    position: static;
  }
  .sb-menu {
    left: 12px;
    right: 12px;
    top: calc(100% + 4px);
    min-width: 0;
  }
}
/* moving between the home page and a language fades one page out and the next one in */
html {
  background: var(--paper);
  scrollbar-gutter: stable;
}
body {
  animation: nbPageIn 0.38s ease-out both;
}
body.nb-leaving {
  opacity: 0;
  transition: opacity 0.22s ease-in;
}
@keyframes nbPageIn {
  from {
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  body {
    animation: none;
  }
  body.nb-leaving {
    transition: none;
  }
}
/* menus fade and slide in, and fade out again when the pointer leaves */
.sb-dd summary {
  transition:
    border-color 0.15s,
    background-color 0.15s;
}
.sb-dd summary:hover,
.sb-dd[open] summary {
  background: var(--surface);
}
.sb-dd[open] .sb-menu {
  animation: sbIn 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes sbIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
}
.sb-i {
  transition: background-color 0.12s;
}
.sb-c {
  transition: transform 0.18s;
}
@media (prefers-reduced-motion: reduce) {
  .sb-c,
  .sb-dd summary,
  .sb-i {
    transition: none;
  }
  .sb-dd[open] .sb-menu {
    animation: none;
  }
}
/* ---------- account button, log in and unlock dialogs, and locked parts ---------- */
.sb-acct summary {
  gap: 6px;
}
.acct-ic {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}
.acct-dlg {
  width: min(26rem, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 26px 24px 22px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(10, 16, 30, 0.28);
  font-family: var(--f-body);
}
.acct-dlg::backdrop {
  background: rgba(12, 18, 30, 0.45);
}
.acct-dlg h2 {
  margin: 0 0 10px;
  font: 700 1.35rem/1.2 var(--f-display);
  padding-right: 28px;
}
.acct-dlg p {
  margin: 0 0 12px;
}
.acct-x {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink-2);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.acct-x:hover {
  background: var(--paper);
}
.acct-dlg .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  margin-top: 4px;
  border-radius: 10px;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  font: 600 1rem/1 var(--f-body);
  cursor: pointer;
}
.acct-dlg .btn.primary {
  background: var(--accent);
  color: var(--on-accent);
  border-color: transparent;
}
.acct-dlg .btn:disabled {
  opacity: 0.6;
  cursor: default;
}
.acct-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  background: var(--surface);
}
.acct-google:hover {
  border-color: var(--ink-2);
}
.acct-google svg {
  width: 20px;
  height: 20px;
}
.acct-or {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-2);
  font-size: 0.85rem;
  margin: 14px 0 !important;
}
.acct-or::before,
.acct-or::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--rule);
}
.acct-form {
  display: grid;
  gap: 10px;
}
.acct-form label {
  display: grid;
  gap: 4px;
  font-weight: 600;
  font-size: 0.92rem;
}
.acct-form input {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--rule);
  border-radius: 9px;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem var(--f-body);
}
.acct-form input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.acct-hint,
.acct-note {
  font-size: 0.88rem;
  color: var(--ink-2);
}
.acct-err {
  color: #b3261e;
  font-size: 0.92rem;
}
.acct-err:empty {
  display: none;
}
.acct-switch {
  margin: 16px 0 0 !important;
  text-align: center;
  font-size: 0.92rem;
  color: var(--ink-2);
}
.acct-switch button {
  border: 0;
  background: none;
  color: var(--accent);
  font: 600 0.92rem var(--f-body);
  cursor: pointer;
  text-decoration: underline;
  padding: 4px;
}
.acct-list {
  margin: 0 0 16px;
  padding-left: 20px;
  display: grid;
  gap: 4px;
}
.acct-test {
  font-size: 0.85rem;
  background: var(--mark, #ffe066);
  color: var(--mark-ink, #1b2442);
  padding: 6px 10px;
  border-radius: 8px;
}
:root[data-theme="dark"] .acct-err {
  color: #ff8a80;
}
/* locked parts of the free version */
.locked {
  display: grid;
  justify-items: center;
  gap: 6px;
  text-align: center;
  padding: 28px 18px;
  border: 1.5px dashed var(--rule);
  border-radius: 12px;
  background: var(--paper);
  margin: 8px 0;
}
.locked .lk-t {
  margin: 0;
  font-weight: 700;
  font-size: 1.05rem;
}
.locked .meta {
  margin: 0 0 6px;
  max-width: 30rem;
}
.locked .btn {
  width: auto;
}
.lk-svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: var(--ink-2);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.lk .lk-svg {
  width: 18px;
  height: 18px;
}
/* ---------- the person button and its menu ---------- */
.sb-acct summary {
  padding: 0 6px 0 6px;
  min-width: 40px;
  justify-content: center;
}
.sb-acct summary .acct-face {
  width: 28px;
  height: 28px;
}
.acct-face {
  display: block;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  background: var(--paper);
}
.acct-ini {
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  font-family: var(--f-body);
}
.sb-acct .sb-menu {
  min-width: 16rem;
}
.sb-acct .sb-i {
  grid-template-columns: auto minmax(0, 1fr) auto;
}
.sb-acct .sb-i .acct-ic {
  color: var(--ink-2);
}
/* ---------- panels: back button, settings, account ---------- */
.acct-bk {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 0;
  background: none;
  color: var(--ink-2);
  font: 600 0.9rem/1 var(--f-body);
  padding: 8px 8px 8px 2px;
  border-radius: 8px;
  cursor: pointer;
}
.acct-bk:hover {
  color: var(--ink);
  background: var(--paper);
}
.acct-bk svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.acct-dlg:has(.acct-bk) {
  padding-top: 52px;
}
.acct-sec {
  margin: 14px 0 8px !important;
  font: 600 0.7rem/1 var(--f-body);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.acct-grp {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}
.acct-lab {
  font-weight: 600;
  font-size: 0.92rem;
}
.acct-seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--paper);
}
.acct-seg button {
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--ink);
  font: 500 0.9rem/1 var(--f-body);
  padding: 9px 0;
  cursor: pointer;
}
.acct-seg button[aria-pressed="true"] {
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  font-weight: 700;
}
.acct-pals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.acct-pals button {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font: 500 0.85rem/1.25 var(--f-body);
  padding: 9px;
  text-align: left;
  cursor: pointer;
  min-width: 0;
}
.acct-pals button[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.acct-pals .sw i {
  width: 12px;
  height: 12px;
}
.acct-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--paper);
}
.acct-row b {
  font-size: 0.95rem;
}
.acct-row small {
  display: block;
  font-size: 0.82rem;
  color: var(--ink-2);
  margin-top: 2px;
}
.acct-sw {
  position: relative;
  width: 46px;
  height: 28px;
  border-radius: 14px;
  border: 0;
  background: #c3c9d4;
  cursor: pointer;
  flex: none;
  transition: background 0.2s;
}
.acct-sw i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s;
}
.acct-sw.on {
  background: var(--accent);
}
.acct-sw.on i {
  transform: translateX(18px);
}
/* furigana switched off in Profile → Learning: the kanji stay, the small kana above them go */
html[data-furi="off"] ruby rt {
  display: none;
}
.acct-sw:focus-visible,
.acct-seg button:focus-visible,
.acct-pals button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.acct-foot {
  margin-top: 12px !important;
}
.acct-pic {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 6px;
}
.acct-pic > div {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.acct-lnk {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: none;
  padding: 3px 0;
  color: var(--accent);
  font: 600 0.9rem/1.2 var(--f-body);
  cursor: pointer;
  text-decoration: none;
}
.acct-lnk.mute {
  color: var(--ink-2);
  font-weight: 500;
}
.acct-lnk .acct-ic {
  width: 16px;
  height: 16px;
}
.acct-fld {
  display: grid;
  gap: 5px;
  margin-bottom: 12px;
  font-size: 0.9rem;
}
.acct-fld > span {
  font-weight: 600;
}
.acct-fld input {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--rule);
  border-radius: 9px;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem var(--f-body);
}
.acct-val {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--rule);
  border-radius: 9px;
  background: var(--paper);
  font-size: 0.95rem;
  margin-bottom: 6px;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.acct-val b {
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}
.acct-g svg {
  width: 16px;
  height: 16px;
}
.acct-ok {
  color: var(--ok, #14734a);
  font-weight: 600;
}
.acct-rowbtn {
  width: 100%;
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.acct-rowbtn:hover {
  border-color: var(--ink-2);
}
.acct-chev {
  font-size: 1.2rem;
  color: var(--ink-2);
}
.acct-cta {
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 12px;
  background: var(--paper);
  display: grid;
  gap: 8px;
  margin-top: 2px;
}
.acct-cta > b {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
}
.acct-cta p {
  margin: 0 !important;
  font-size: 0.85rem;
  color: var(--ink-2);
}
.acct-dlg .btn.sm {
  min-height: 38px;
  font-size: 0.9rem;
  margin-top: 0;
}
.acct-sub {
  border: 1px dashed var(--rule);
  border-radius: 10px;
  padding: 12px;
  margin: 8px 0;
}
.acct-two {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}
.acct-two .btn {
  padding: 0 14px;
}
.acct-rules {
  list-style: none;
  margin: -2px 0 6px;
  padding: 0;
  display: grid;
  gap: 3px;
  font-size: 0.85rem;
  color: var(--ink-2);
}
.acct-rules li::before {
  content: "○";
  display: inline-block;
  width: 18px;
}
.acct-rules li.on {
  color: var(--ok, #14734a);
}
.acct-rules li.on::before {
  content: "✓";
  font-weight: 700;
}
.acct-pwmsg {
  margin: 0 0 8px !important;
  font-size: 0.88rem;
  font-weight: 600;
}
.acct-pwmsg:empty {
  display: none;
}
.acct-pwmsg.good {
  color: var(--ok, #14734a);
}
.acct-pwmsg.good::before {
  content: "✓ ";
}
.acct-pwmsg.bad {
  color: #b3261e;
}
.acct-msg {
  margin: 0 0 8px !important;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-2);
}
.acct-msg:empty {
  display: none;
}
.acct-msg.ok {
  color: var(--ok, #14734a);
}
.acct-msg.bad {
  color: #b3261e;
}
.acct-done {
  margin: 8px 0 !important;
  font-weight: 600;
  color: var(--ok, #14734a);
}
.acct-ask {
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
}
.acct-ask .acct-face {
  width: 60px;
  height: 60px;
}
.acct-ask h2 {
  padding: 0 !important;
  margin: 0 !important;
}
.acct-ask hr {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 4px 0;
}
.acct-hi {
  margin: 0 !important;
  font-size: 1.05rem;
}
.acct-ask .btn {
  margin: 0;
}
:root[data-theme="dark"] .acct-pwmsg.bad,
:root[data-theme="dark"] .acct-msg.bad {
  color: #ff8a80;
}
@media (prefers-reduced-motion: reduce) {
  .acct-sw,
  .acct-sw i {
    transition: none;
  }
}
/* ---------- changing notebook (Stamp + Ripple) ---------- */
html.nbsw-in body,
html.nbsw-done body {
  animation: none !important;
}
html.nbsw-in::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  background: var(--nbsw-bg, #22304a);
}
/* the stamp the same size as on the page you left (switch.js: 42% of the shorter side of the visible window); dvh is
   the visible height, so a phone's address bar does not make it jump */
@supports (height: 1dvh) {
  html.nbsw-in::after {
    background-size:
      min(42vw, 42dvh) auto,
      auto;
  }
}
.nbsw {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  overflow: hidden;
}
.nbsw-r {
  position: absolute;
  border-radius: 50%;
}
.nbsw-d {
  position: absolute;
  color: #fff;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
}
.nbsw-mid {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}
.nbsw-stamp {
  position: relative;
}
.nbsw-ring {
  position: absolute;
  inset: 0;
  transform-origin: 50% 50%;
}
.acct-right {
  align-self: flex-end;
  justify-self: end;
  margin: -4px 0 4px;
}
.acct-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--paper);
  border: 1px solid var(--rule);
  color: var(--accent);
  font-size: 1.4rem;
  font-weight: 700;
}
.acct-icon .acct-ic {
  width: 24px;
  height: 24px;
}
.acct-icon.ok {
  background: var(--ok, #14734a);
  border-color: transparent;
  color: #fff;
}
.acct-ask .acct-hint {
  margin: 0 !important;
}

.acct-tourb {
  flex: none;
  font: inherit;
  font-size: 0.9rem;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: inherit;
  cursor: pointer;
}
.acct-tourb:hover {
  border-color: var(--ink-2);
}

/* ---------- writing check: after Check the writing box turns into the result, in the same place:
   the similarity, then yours and the model as two separate boxes, short notes and Write again ---------- */
.wcres {
  width: min(100%, 28.75rem);
  margin: 0 auto;
  display: grid;
  gap: 12px;
  animation: wcin 0.25s ease;
}
@keyframes wcin {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
#padbox[hidden],
#wacts[hidden],
.wcres[hidden] {
  display: none !important;
}
.wcpair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  width: 100%;
}
.wcpair figure {
  margin: 0;
  display: grid;
  gap: 6px;
  justify-items: center;
}
.wcpair figcaption {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-2);
}
.wcbox {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--surface);
  position: relative;
  overflow: hidden;
}
.wcbox::before,
.wcbox::after {
  content: "";
  position: absolute;
  border: 0 dashed var(--rule);
  pointer-events: none;
}
.wcbox::before {
  left: 50%;
  top: 0;
  bottom: 0;
  border-left-width: 1px;
}
.wcbox::after {
  top: 50%;
  left: 0;
  right: 0;
  border-top-width: 1px;
}
.wcbox svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.wcyours path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.wcyours path.bad {
  stroke: var(--bad);
}
.wcyours text {
  font: 700 7px/1 var(--f-body, sans-serif);
  fill: var(--accent);
}
.wcmodel .kvg path {
  stroke-dashoffset: 0 !important;
  animation: none !important;
}
/* ---------- grammar quizzes: the box after a lesson, level checks, questions and the result ---------- */
.gqstamp {
  display: inline-grid;
  place-items: center;
  align-content: center;
  width: 4.6rem;
  height: 4.6rem;
  border: 2.5px solid var(--bad);
  border-radius: 50%;
  color: var(--bad);
  transform: rotate(-9deg);
  font: 700 1.2rem/1 var(--f-body);
  flex: none;
}
.gqstamp small {
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 3px;
}
.gqstamp.sm {
  width: 2.5rem;
  height: 2.5rem;
  border-width: 2px;
  font-size: 0.78rem;
}
/* the faint guide in the writing box has no stroke numbers, so you can try the order yourself first; Stroke order shows them */
.kvg.faint text {
  display: none;
}
.wcscore {
  margin: 0;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  text-align: center;
}
.wcscore b {
  font-size: 1.5rem;
  line-height: 1;
}
.wcscore span {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink);
}
.wcscore.ok b {
  color: var(--ok);
}
.wcscore.no b {
  color: var(--bad);
}
.wcnotes {
  margin: 0 auto;
  max-width: 30rem;
  padding-left: 1.2em;
  display: grid;
  gap: 4px;
  font-size: 0.92rem;
  text-align: left;
}
.wcres .meta {
  text-align: center;
  margin: 0;
}
.wcres .acts {
  margin-top: 2px;
}

/* ---------- the creator credit in the footer is a link ---------- */
.by-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
  cursor: pointer;
  border-radius: 4px;
}
.by-link:hover b {
  color: var(--accent);
}

/* colour themes, picked in the site bar; the first is the notebook own one */
:root[data-pal="red-gold"] {
  --k2: #7b3fae;
  --paper: #fbf5ef;
  --paper-line: #f1e6da;
  --surface: #ffffff;
  --ink: #2a1a17;
  --ink-2: #6e5651;
  --rule: #ead9cf;
  --grid: #e2a49b;
  --accent: #b3261e;
  --on-accent: #ffffff;
  --mark: #f6ce4e;
  --mark-ink: #2a1a17;
  --grid-2: #eeccc5;
}
:root[data-pal="red-gold"][data-theme="dark"] {
  --k2: #c9a2f0;
  --paper: #1a1312;
  --paper-line: #221918;
  --surface: #261c1a;
  --ink: #f4e9e4;
  --ink-2: #c0a8a1;
  --rule: #3f2d29;
  --grid: #7c4842;
  --accent: #ff9a8c;
  --on-accent: #3d0d08;
  --mark: #e8c152;
  --mark-ink: #1e1906;
  --grid-2: #4b2e2a;
}
:root[data-pal="jade"] {
  --k1: #2b5fb0;
  --paper: #eff6f2;
  --paper-line: #e0ece5;
  --surface: #ffffff;
  --ink: #142a22;
  --ink-2: #4f675d;
  --rule: #d2e2d9;
  --grid: #8fc4ae;
  --accent: #1d7357;
  --on-accent: #ffffff;
  --mark: #f5d46a;
  --mark-ink: #142a22;
  --grid-2: #bfddd0;
}
:root[data-pal="jade"][data-theme="dark"] {
  --k1: #9dbdf2;
  --paper: #0f1a16;
  --paper-line: #15221d;
  --surface: #18271f;
  --ink: #e5f1eb;
  --ink-2: #9db8ac;
  --rule: #29403a;
  --grid: #3e6656;
  --accent: #7fd8b4;
  --on-accent: #0b2a1f;
  --mark: #e6c65a;
  --mark-ink: #1b1a08;
  --grid-2: #264036;
}
:root[data-pal="ink-rice-paper"] {
  --k2: #7b3fae;
  --paper: #f5f2ea;
  --paper-line: #eae5d8;
  --surface: #fffefa;
  --ink: #1f1e1c;
  --ink-2: #5f5b53;
  --rule: #dfd8c8;
  --grid: #c9a98c;
  --accent: #8e2c22;
  --on-accent: #ffffff;
  --mark: #ebd38c;
  --mark-ink: #1f1e1c;
  --grid-2: #dfcebb;
}
:root[data-pal="ink-rice-paper"][data-theme="dark"] {
  --k2: #c9a2f0;
  --paper: #161513;
  --paper-line: #1d1c19;
  --surface: #22201c;
  --ink: #eeeae1;
  --ink-2: #b3ac9f;
  --rule: #38352e;
  --grid: #6a5440;
  --accent: #f0938a;
  --on-accent: #3a0e0a;
  --mark: #dcc17a;
  --mark-ink: #1b1a0a;
  --grid-2: #40342a;
}

[data-act="listen"]:not(.vok),
.btn[data-act="syl"]:not(.vok) {
  opacity: 0.45;
}
#nbv-soon {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 90;
  transform: translate(-50%, 20px);
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s,
    transform 0.2s;
}
#nbv-soon.on {
  opacity: 1;
  transform: translate(-50%, 0);
}
.kvg.acj path.ao {
  fill: var(--ink);
  stroke: none;
}
.kvg.acj path.am {
  display: none;
  fill: none;
  stroke: var(--ink);
  stroke-width: 150;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.kvg.acj.glyph path.am {
  stroke-width: 17;
}
.kvg.acj text.fin {
  display: none;
}
#kfig svg.kvg:not(.play) text.n,
#kfig svg.kvg:not(.play) > text:not([class]) {
  display: none;
} /* the big box: stroke numbers only during and after the replay */
.kvg.acj.play text.fin {
  display: inline;
  fill: var(--ink);
}
.kvg.acj text {
  font-size: 72px;
}
.kvg.acj.glyph text.n {
  font-size: 7.6px;
}
.kvg.acj .ag {
  font-size: 100px;
  font-weight: 400;
  fill: var(--ink);
}
.kvg.acj text.ag,
.kvg.acj.faint text.ag,
.kvg.acj.play text.ag {
  display: inline;
  opacity: 1;
  animation: none;
}
.kvg.acj text.n {
  paint-order: stroke;
  stroke: var(--paper);
  stroke-width: 14px;
  stroke-linejoin: round;
  font-weight: 600;
}
.kvg.acj.glyph text.n {
  stroke-width: 1.5px;
}
.kvg.acj.faint path.ao,
.kvg.acj.faint .ag {
  fill: var(--grid);
}
.kvg.acj.guide path.ao,
.kvg.acj.guide .ag {
  fill: var(--accent);
  opacity: 0.5;
}
.kvg.acj.play path.ao,
.kvg.acj.play .ag {
  fill: var(--grid);
}
.kvg.acj.play .ag {
  opacity: 1;
  animation: none;
}
.kvg.acj.play path.am {
  display: inline;
}
.sq.wide {
  width: min(100%, calc(var(--n) * 19rem));
}
.cmp.wide {
  max-width: calc(var(--n) * 19rem);
}
.drill:has(.sq.wide) {
  max-width: 100%;
}
.pacebar {
  width: 100%;
  max-width: 20rem;
  margin: 2px auto 0;
  display: grid;
  gap: 6px;
  justify-items: center;
}
.pacebar i {
  display: block;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--rule);
  overflow: hidden;
  position: relative;
}
.pacebar i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ok, #2e8b57);
  transform-origin: left;
  animation: nbpace linear forwards;
  animation-duration: inherit;
}
@keyframes nbpace {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}
.pacebar span,
.wctap {
  font-size: 0.82rem;
  color: var(--ink-2);
}
.wctap {
  margin: 4px 0 0;
  text-align: center;
}
@media (prefers-reduced-motion: reduce) {
  .pacebar i::after {
    animation: none;
    transform: none;
  }
}

#sheet kbd {
  display: none !important;
}
#sheet .acts > [data-act="next"] {
  order: 99;
}
#sheet [data-act="grade"][data-ok="0"] {
  display: none !important;
}
#sheet .opt[aria-disabled] {
  cursor: pointer;
}
.tform {
  flex-direction: column;
  align-items: center;
}
.tform input {
  width: 100%;
}

/* pinyin over the hanzi, like furigana: each word's reading sits over it */
.zrl ruby.zr {
  ruby-position: over;
  /* the characters stay together under a long pinyin instead of spreading apart */
  ruby-align: center;
}
.zrl ruby.zr rt {
  font: 400 max(0.5em, 0.68rem)/1.1 var(--f-py, var(--f-body));
  color: var(--ink-2);
  letter-spacing: 0;
  /* a little room on each side, so two syllables over a word never run together (xué sheng, not xuésheng) */
  padding: 0 0.2em;
}
/* one pinyin over each hanzi; a little more room between words than between the characters of a word */
.zrl ruby.zr + ruby.zr {
  margin-left: 0.04em;
}
.zrl .zw + .zw {
  margin-left: 0.18em;
}
/* the browser makes room for the pinyin itself, so the line needs no extra height: the pinyin and the hanzi sit
   together in the middle of their space */
.zrl {
  line-height: 1.4;
}
