/* The Japanese notebook (japanese.html and full/japanese-full.html) */

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;
}

/* Layout: a practice notebook. Two steps on top (what to study, how to practise); one work sheet built around the
   ruled practice square; study set and progress in a side column that drops below the sheet on phones.
   Light theme is the paper notebook, dark theme is the classroom blackboard. */
:root {
  --paper: #f1f5f1;
  --paper-line: #e2eae4;
  --surface: #ffffff;
  --ink: #18233f;
  --ink-2: #56617a;
  --rule: #d3ddd6;
  --grid: #9cc7b9;
  --accent: #2b4ea2;
  --on-accent: #ffffff;
  --mark: #ffe066;
  --mark-ink: #18233f;
  --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-kana: "Klee One", "Hiragino Maru Gothic ProN", "Yu Gothic", "Noto Sans CJK JP", "Noto Sans JP", sans-serif;
}
:root[data-theme="dark"] {
  --paper: #121b17;
  --paper-line: #18241f;
  --surface: #1a2621;
  --ink: #e9efe8;
  --ink-2: #9fb0a6;
  --rule: #2d4037;
  --grid: #46655a;
  --accent: #9dc1f6;
  --on-accent: #0f1f3a;
  --mark: #efd15f;
  --mark-ink: #1b1d0e;
  --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="gothic"] {
  --f-kana: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans CJK JP", sans-serif;
}
:root[data-font="mincho"] {
  --f-kana: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif CJK JP", 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 {
  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,
p {
  margin: 0;
}
[lang="ja"] {
  font-family: var(--f-kana);
}
.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="ja"] {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
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="ja"] {
  font-size: 1.3rem;
  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="ja"] {
  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 {
  font: inherit;
  color: inherit;
  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);
}
.stack {
  display: grid;
  gap: 22px;
}
.full {
  width: 100%;
}
.tp-prompt {
  display: grid;
  gap: 14px;
  justify-items: center;
  width: 100%;
}
.kans {
  display: grid;
  gap: 6px;
  justify-items: center;
}
.kans p {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  align-items: baseline;
  justify-content: center;
}
.kans .sub {
  margin: 0;
}
.sq .mt {
  font: 600 1.2rem/1.25 var(--f-display);
  font-size: 9.5cqi;
  padding: 8%;
  text-align: center;
  text-wrap: balance;
}
.kword b {
  font-weight: inherit;
  color: var(--accent);
}

.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;
}
/* a chart of five columns would only stretch its cells on a wide page: it keeps about the size it had */
.layout.wide .rows.n5 {
  max-width: 42rem;
}
.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;
}
.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;
}

/* practice square: the ruled box from a kana workbook */
.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: 64cqi;
  line-height: 1;
  font-weight: 400;
}
.sq .g.two {
  font-size: 5.6rem;
  font-size: 42cqi;
  letter-spacing: -0.04em;
}
.sq .rm {
  font: 500 3rem/1 var(--f-mono);
  font-size: 24cqi;
}
.sq.sm {
  width: 7.5rem;
  flex: none;
}
.sq .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);
}
.sq .under {
  position: absolute;
  bottom: 7%;
  left: 0;
  right: 0;
  text-align: center;
  font: 500 1.4rem/1 var(--f-mono);
  font-size: 11cqi;
  color: var(--accent);
}
.card {
  cursor: pointer;
}
.card.flipped .g {
  transform: translateY(-6%);
}

.drill {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  gap: 18px;
  width: 100%;
  max-width: 27rem;
  margin-inline: auto;
  text-align: center;
}
.ask {
  font-weight: 500;
  font-size: 1.05rem;
}
.ask .rm,
.rm-s,
.rm-m {
  font-family: var(--f-mono);
}
.ask .rm {
  font-size: 1.3rem;
  font-weight: 500;
  padding-inline: 4px;
  box-shadow: inset 0 calc(-1 * var(--mark-depth)) 0 var(--mark);
}
.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;
}
kbd {
  font: 500 0.72rem/1 var(--f-mono);
  border: 1px solid currentColor;
  border-radius: 4px;
  padding: 2px 5px;
  opacity: 0.6;
}
.lnk {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0 3px;
  font-size: 1.15em;
}

.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;
  font: 500 1.35rem/1.1 var(--f-mono);
}
.opt[lang="ja"] {
  font: 400 2.3rem/1.1 var(--f-kana);
}
.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="ja"] {
  font-size: 1.25em;
}

.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-mono);
  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);
}

.word {
  display: flex;
  justify-content: center;
  gap: 4px;
  width: 100%;
}
.word .u {
  flex: 0 1 4.6rem;
  min-width: 0;
  display: grid;
  gap: 5px;
  justify-items: center;
}
.word .sq {
  width: 100%;
}
.word .ur {
  font: 500 0.95rem/1 var(--f-mono);
  color: var(--accent);
  min-height: 1em;
}
.mean {
  font: 600 1.1rem/1.3 var(--f-display);
}

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

.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);
}

/* chart */
.tag {
  font: 600 0.72rem/1 var(--f-body);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.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);
}
.rows {
  display: grid;
  gap: 5px;
}
.rows.n3 {
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: 5px 22px;
}
.krow {
  display: grid;
  grid-template-columns: 2.7rem repeat(5, minmax(0, 1fr));
  gap: 5px;
  align-items: stretch;
}
.n3 .krow {
  grid-template-columns: 2.7rem repeat(3, minmax(0, 1fr));
}
.krow.head span {
  text-align: center;
  font: 500 0.8rem/1 var(--f-mono);
  color: var(--ink-2);
}
/* the row's name at the start of each chart row */
.rowlab {
  display: grid;
  place-items: center;
  font: 500 0.85rem/1 var(--f-mono);
  border: 1px solid var(--mark);
  border-radius: 6px;
  background: var(--mark);
  color: var(--mark-ink);
}
.cell {
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 6px 2px 5px;
  display: grid;
  gap: 3px;
  justify-items: center;
  background: var(--paper);
  color: var(--ink);
  min-width: 0;
}
.cell.gap {
  border-style: dashed;
  opacity: 0.5;
}
.gs {
  display: flex;
  justify-content: center;
  gap: 1px;
  flex-wrap: wrap;
}
.gl {
  font-size: clamp(1.35rem, 5.2vw, 2rem);
  line-height: 1.15;
  padding: 0 4px 5px;
  border-radius: 5px;
  display: grid;
  justify-items: center;
  gap: 3px;
  white-space: nowrap;
}
.n3 .gl {
  font-size: clamp(1.15rem, 4.4vw, 1.6rem);
}
@media (hover: hover) {
  .gl:hover {
    background: var(--surface);
  }
}
.gl.sel {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  background: var(--surface);
  color: var(--ink);
}
.pip {
  display: block;
  width: 1.1rem;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--ok) calc(var(--n) * 33.4%), var(--rule) 0);
}
.rom {
  font: 400 0.74rem/1 var(--f-mono);
}

/* 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;
}
.sub {
  font: 600 0.72rem/1 var(--f-body);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-top: 4px;
}
.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="ja"] {
  font-size: 1.05rem;
  color: var(--ink);
}
.chip[aria-pressed="true"] {
  background: var(--mark);
  border-color: var(--mark);
  color: var(--mark-ink);
}
.chip[aria-pressed="true"] [lang="ja"] {
  color: var(--mark-ink);
}
.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;
}
.legend {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: space-between;
  gap: 6px;
  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);
}

/* stroke order diagrams */
.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;
  }
}
.pad .so {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.pad.noguide .so {
  visibility: hidden;
}
.pad.hasso .g {
  visibility: hidden;
}

/* kanji */
.kgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr));
  gap: 6px;
}
.kt {
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 8px 3px 7px;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 3px;
  background: var(--paper);
  min-width: 0;
}
.kt [lang="ja"] {
  font-size: 2rem;
  line-height: 1.15;
}
.kt small {
  font-size: 0.72rem;
  line-height: 1.2;
  color: var(--ink-2);
  text-align: center;
  overflow-wrap: anywhere;
}
@media (hover: hover) {
  .kt:hover {
    border-color: var(--accent);
  }
}
.kt.off {
  background: none;
}
.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-mean {
  font: 700 1.55rem/1.2 var(--f-display);
  text-wrap: balance;
}
.rd {
  display: grid;
  gap: 6px;
  margin: 0;
}
.rd dt {
  font-weight: 600;
  font-size: 0.92rem;
  margin-top: 6px;
}
.rd dt small {
  font-weight: 400;
  color: var(--ink-2);
  font-size: 0.84rem;
}
.rd dd {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  align-items: baseline;
}
.rdg [lang="ja"] {
  font-size: 1.3rem;
}
.rm-s {
  font-size: 0.86rem;
  color: var(--ink-2);
}
.oku {
  color: var(--ink-2);
}
.hint {
  background: var(--paper);
  border-radius: 8px;
  padding: 10px 14px;
  display: grid;
  gap: 4px;
}
.hint .sub {
  margin: 0;
}
.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.5rem, max-content) minmax(0, 1fr) auto;
  }
  .wl > .wr {
    grid-column: 1 / -1;
    grid-template-columns: subgrid;
  }
}
.wr {
  display: grid;
  grid-template-columns: minmax(4.5rem, auto) minmax(0, 1fr) auto;
  gap: 6px 16px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
}
.wr .w {
  font-size: 1.55rem;
  line-height: 1.2;
  white-space: nowrap;
}
.wr .w b,
.wr .k0 {
  /* the kanji this page is about in the theme colour; every other kanji in a colour of its own, and its part of the
     reading and rōmaji 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;
}
.btn.ic {
  padding: 8px;
  min-height: 38px;
  min-width: 38px;
  justify-content: center;
}
.kword {
  font-size: clamp(2.4rem, 11vw, 3.6rem);
  line-height: 1.15;
}
.hl {
  padding-inline: 4px;
  font-weight: 600;
  box-shadow: inset 0 calc(-1 * var(--mark-depth)) 0 var(--mark);
}
.opt.txt {
  font: 500 1rem/1.25 var(--f-body);
}
.opt.rdo[lang="ja"] {
  font-size: 1.3rem;
}
.chip span.n {
  opacity: 0.7;
}
.by-credits {
  color: inherit;
}
@media (max-width: 640px) {
  .kd-top {
    grid-template-columns: minmax(0, 1fr);
  }
  .kd-fig .sq {
    width: min(100%, 15rem);
  }
}

/* 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: 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.78rem, 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.84rem, 4.6vw);
    padding: 10px 1px;
  }
}
@media (max-width: 480px) {
  .seg button {
    padding: 6px 9px;
    font-size: 0.85rem;
  }
  .sheet {
    padding: 16px 12px;
  }
  h1 [lang="ja"] {
    font-size: 1.7rem;
  }
  .krow,
  .n3 .krow {
    gap: 3px;
  }
  .krow {
    grid-template-columns: 2.2rem repeat(5, minmax(0, 1fr));
  }
  .n3 .krow {
    grid-template-columns: 2.2rem repeat(3, minmax(0, 1fr));
  }
}
@media (prefers-reduced-motion: no-preference) {
  .btn,
  .opt,
  .chip,
  .gl {
    transition:
      border-color 0.12s,
      background-color 0.12s;
  }
}
.sheet {
  scroll-margin-top: 5.5rem;
}
.subj button,
.tabs button,
.pad {
  user-select: none;
  -webkit-user-select: none;
}
/* 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.35rem;
  line-height: 1.5;
}
.ex.big .ex-j {
  font-size: 1.6rem;
}
.pt {
  color: var(--accent);
  font-weight: inherit;
}
.pt.fill {
  background: var(--mark);
  color: var(--mark-ink);
  border-radius: 3px;
  padding-inline: 3px;
}
.blank {
  display: inline-block;
  width: 1.7em;
  height: 1.1em;
  vertical-align: -0.15em;
  border-bottom: 2px solid var(--accent);
  margin-inline: 3px;
}
.ex-r {
  font-size: 0.9rem;
  color: var(--ink-2);
}
.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="ja"] {
  font-size: 1.2em;
  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="ja"] {
  font-size: 1.12em;
}
.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;
}
.pcard {
  position: relative;
  width: 100%;
  min-height: 10rem;
  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 .corner {
  position: absolute;
  top: 8px;
  left: 10px;
  font: 500 0.72rem/1 var(--f-body);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.pcard .pj {
  font-size: 1.75rem;
  line-height: 1.4;
}
.tlnk {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-align: left;
}
.kword .oku {
  font-size: 0.6em;
}
.bar .b3 {
  background: var(--ok);
}
.legend {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}
.legend .l3::before {
  background: var(--ok);
}
.pip {
  background: linear-gradient(to right, var(--pc, var(--ok)) calc(var(--n) * 16.67%), var(--rule) 0);
}
.pip.due {
  --pc: var(--accent);
}
.fb small {
  display: block;
  font-size: 0.82rem;
  font-weight: 400;
  opacity: 0.9;
  margin-top: 2px;
}

.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;
}
.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);
}
.zr .rm {
  font: 500 2.3rem/1 var(--f-mono);
}
.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));
}

.lvh {
  margin: 6px 0 8px;
  font: 600 0.78rem/1 var(--f-body);
  letter-spacing: 0.12em;
  color: var(--ink-2);
}
.llist + .lvh {
  margin-top: 20px;
}

.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 {
  pointer-events: none;
}
.pad .corner {
  z-index: 1;
}

.kt.back {
  outline: 3px solid var(--mark);
  outline-offset: 2px;
  transition: outline-color 1s;
}

.find {
  width: 100%;
  max-width: 24rem;
  border: 1.5px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
  padding: 9px 12px;
  font: inherit;
  color: inherit;
}
.find:focus {
  outline: none;
  border-color: var(--accent);
}
.kc {
  font: inherit;
  /* a kanji you can tap is in the accent colour, like a link */
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
@media (hover: hover) {
  .kc:hover {
    text-decoration: underline;
    text-underline-offset: 0.15em;
  }
}

.rl {
  --rc: currentColor;
  color: var(--rc);
  text-decoration: underline 2px var(--rc);
  text-underline-offset: 5px;
  text-decoration-skip-ink: none;
}
.r-s {
  --rc: #7b3fa8;
}
.r-o {
  --rc: #0e7378;
}
.r-t {
  --rc: #b05a07;
}
.r-p {
  --rc: #a12e64;
}
.r-w {
  --rc: #56701a;
}
.r-m {
  --rc: #6e5a34;
}
:root[data-theme="dark"] .r-s {
  --rc: #d3a6f0;
}
:root[data-theme="dark"] .r-o {
  --rc: #6fd3d8;
}
:root[data-theme="dark"] .r-t {
  --rc: #f2b26b;
}
:root[data-theme="dark"] .r-p {
  --rc: #f09ac6;
}
:root[data-theme="dark"] .r-w {
  --rc: #c2db82;
}
:root[data-theme="dark"] .r-m {
  --rc: #d9c49c;
}
.pq .ex-j {
  line-height: 2.3;
}
.pq ruby rt {
  font-size: 0.45em;
  letter-spacing: 0.02em;
  color: var(--ink-2);
}
.ex-j ruby rt,
.jw ruby rt {
  font-size: 0.5em;
  letter-spacing: 0.02em;
  color: var(--ink-2);
}
.pq .ex-e {
  font-size: 1.02rem;
}
.rlegend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 6px 0 0;
  font-size: 0.84rem;
}

.pq .tk,
.pq .pt {
  white-space: nowrap;
}
.pq .ex-j {
  line-height: 2.15;
}

.pq .rl,
.rlegend .rl {
  color: inherit;
  text-decoration: none;
  background: var(--rc);
  border-radius: 5px;
  padding: 1px 3px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.pq .ex-e .rl {
  padding: 0 3px;
}
.r-s {
  --rc: #e6d5f8;
}
.r-o {
  --rc: #cdefe3;
}
.r-v {
  --rc: #d3e5ff;
}
.r-a {
  --rc: #e6f4c4;
}
.r-t {
  --rc: #ffddbf;
}
.r-p {
  --rc: #fad1e3;
}
.r-w {
  --rc: #f1e2c6;
}
.r-m {
  --rc: #e2e2e2;
}
:root[data-theme="dark"] .r-s {
  --rc: #4a3566;
}
:root[data-theme="dark"] .r-o {
  --rc: #1f4a3d;
}
:root[data-theme="dark"] .r-v {
  --rc: #23395c;
}
:root[data-theme="dark"] .r-a {
  --rc: #3b4a1e;
}
:root[data-theme="dark"] .r-t {
  --rc: #5a3a1c;
}
:root[data-theme="dark"] .r-p {
  --rc: #5a2440;
}
:root[data-theme="dark"] .r-w {
  --rc: #4a3e2a;
}
:root[data-theme="dark"] .r-m {
  --rc: #3a3a3a;
}
.rlegend {
  gap: 6px 8px;
}

.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, name, 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 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-size: 0.82rem;
  line-height: 1.2;
  color: var(--accent);
}

.sq.wide {
  aspect-ratio: var(--n) / 1;
  width: min(100%, calc(var(--n) * 9.5rem));
}

.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;
}
/* ---------- a lesson passed: the stamp in the list of lessons ---------- */
.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="sakura"] {
  --k2: #7b3fae;
  --paper: #fbf3f4;
  --paper-line: #f1e3e6;
  --surface: #ffffff;
  --ink: #2a1e24;
  --ink-2: #6e5a62;
  --rule: #ead6db;
  --grid: #e7a9ba;
  --accent: #b8325a;
  --on-accent: #ffffff;
  --mark: #ffd9a8;
  --mark-ink: #2a1e24;
  --grid-2: #f1ced7;
}
:root[data-pal="sakura"][data-theme="dark"] {
  --k2: #c9a2f0;
  --paper: #1b1416;
  --paper-line: #231a1d;
  --surface: #261c20;
  --ink: #f3e9ec;
  --ink-2: #bfa8b0;
  --rule: #3e2d33;
  --grid: #6e3a49;
  --accent: #f49ab4;
  --on-accent: #3a0f1e;
  --mark: #e9b97a;
  --mark-ink: #22160a;
  --grid-2: #442730;
}
:root[data-pal="washi-vermilion"] {
  --k2: #7b3fae;
  --k3: #2f5ea8;
  --paper: #f7f1e6;
  --paper-line: #ece3d2;
  --surface: #fffdf8;
  --ink: #2b241b;
  --ink-2: #6e6352;
  --rule: #e2d6c0;
  --grid: #d8b48a;
  --accent: #b5432a;
  --on-accent: #ffffff;
  --mark: #f3d36b;
  --mark-ink: #2b241b;
  --grid-2: #e8d2b8;
}
:root[data-pal="washi-vermilion"][data-theme="dark"] {
  --k2: #c9a2f0;
  --k3: #9dbdf2;
  --paper: #1a1611;
  --paper-line: #221d17;
  --surface: #262019;
  --ink: #f1eadf;
  --ink-2: #b9ac98;
  --rule: #3d3428;
  --grid: #6b5233;
  --accent: #f09a7e;
  --on-accent: #3a130a;
  --mark: #e2c35e;
  --mark-ink: #1f1a08;
  --grid-2: #423422;
}
:root[data-pal="ai-indigo"] {
  --paper: #eff2f8;
  --paper-line: #e1e6f0;
  --surface: #ffffff;
  --ink: #172040;
  --ink-2: #55607c;
  --rule: #d3dae7;
  --grid: #a3b4d8;
  --accent: #2c3f8c;
  --on-accent: #ffffff;
  --mark: #ffe07a;
  --mark-ink: #172040;
  --grid-2: #c9d3e8;
}
:root[data-pal="ai-indigo"][data-theme="dark"] {
  --paper: #10141f;
  --paper-line: #161b28;
  --surface: #19202f;
  --ink: #e8ecf5;
  --ink-2: #a0aac2;
  --rule: #2c354b;
  --grid: #3e4e78;
  --accent: #9fb4f5;
  --on-accent: #101c45;
  --mark: #e8c95c;
  --mark-ink: #1b1a10;
  --grid-2: #27314c;
}

[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));
}
.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;
}
.rdg .btn.ic {
  margin-left: 4px;
  vertical-align: middle;
  width: 2rem;
  height: 2rem;
  padding: 0;
}
@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%;
}


/* the Words list: the speaker button and the progress dot share the last column */

/* the kana chart: hiragana and katakana side by side; on a narrow screen one at a time, with a switch above */
.kduo {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px 34px;
  align-items: start;
}
.kduo > .seg {
  display: none;
  justify-self: start;
}
.kcol {
  display: grid;
  gap: 12px;
  min-width: 0;
}
.kcol-h {
  margin: 0;
  font: 600 1.15rem/1.2 var(--f-display);
}
.kcol-h [lang="ja"] {
  margin-right: 4px;
}
@media (max-width: 900px) {
  .kduo {
    grid-template-columns: minmax(0, 1fr);
  }
  .kduo > .seg {
    display: flex;
  }
  .kcol-h,
  .kduo[data-show="h"] .kcol[data-sc="k"],
  .kduo[data-show="k"] .kcol[data-sc="h"] {
    display: none;
  }
}
/* what Kana practises, above the study set */
.kpick {
  display: grid;
  gap: 6px;
  margin-bottom: 4px;
}
.kpick .sub {
  margin: 0;
}

/* ---------- Grammar → Forms: every form of a verb or adjective ---------- */
.fm-list {
  display: grid;
  gap: 8px;
}
.lrow.fm-row {
  grid-template-columns: minmax(0, 1fr) auto;
}
.fm-row b {
  font-size: 1.12rem;
}
/* the list: a group a section, its words as small tiles, several to a row */
.fm-grp-sec {
  display: grid;
  gap: 8px;
}
.fm-grp-sec + .fm-grp-sec {
  margin-top: 14px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
}
.fm-gh {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.3;
}
.fm-gh small {
  padding: 1px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink-2) 12%, transparent);
  font: 600 0.72rem/1.5 var(--f-mono);
  color: var(--ink-2);
}
.fm-grp-sec > .meta {
  margin: -2px 0 4px;
  line-height: 1.5;
}
/* a level inside a group, when several levels are chosen: a small label with a hairline after it */
.fm-lvh {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0 0;
  font: 600 0.72rem var(--f-body);
  letter-spacing: 0.08em;
  color: var(--ink-2);
}
.fm-lvh::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}
.fm-lvh small {
  font-family: var(--f-mono);
  font-weight: 500;
}
.fm-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6.6rem, 1fr));
  gap: 6px;
}
.fm-tile {
  position: relative;
  display: grid;
  gap: 3px;
  justify-items: center;
  /* words without furigana (ある) line up with the rest */
  align-content: end;
  min-width: 0;
  padding: 9px 6px 8px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  text-align: center;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.fm-tile:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
}
.fm-tile b {
  max-width: 100%;
  font-size: 1.3rem;
  font-weight: 500;
  line-height: 1.35;
  white-space: nowrap;
}
.fm-tile rt {
  font-size: 0.45em;
}
/* the meaning on one line, like the kanji chart; a long one ends in "…" (the word's page shows it in full) */
.fm-tile small {
  max-width: 100%;
  color: var(--ink-2);
  font-size: 0.72rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fm-lv {
  position: absolute;
  top: 6px;
  right: 8px;
  font: 600 0.62rem var(--f-body);
  font-style: normal;
  color: var(--ink-2);
}
/* phones: three small tiles a row, two on the narrowest */
@media (max-width: 600px) {
  .fm-tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }
  .fm-tile {
    padding: 7px 4px;
  }
  .fm-tile b {
    font-size: 1.15rem;
  }
  .fm-tile small {
    font-size: 0.7rem;
  }
}
@media (max-width: 340px) {
  .fm-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
/* the coloured ending inside a row's word stays on its line */
.fm-row b .fm-c {
  display: inline;
  font: inherit;
  color: var(--k2);
}
.fm-g {
  font-size: 0.8rem;
  color: var(--ink-2);
  white-space: nowrap;
}
.fm-page {
  display: grid;
  gap: 22px;
  margin-top: 16px;
}
/* the word on the left, its meaning and group beside it (under it on a phone) */
.fm-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 6px 28px;
}
.fm-wd,
.fm-info {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.fm-info {
  padding-bottom: 4px;
}
.fm-grp .al-lv {
  margin-left: 8px;
}
/* the jump bar over a word's sections: stays at the top while the forms scroll */
.fm-jump {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -4px;
  padding: 8px 4px;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}
.fm-jump::-webkit-scrollbar {
  display: none;
}
.fm-jump .chip {
  flex: 0 0 auto;
  font-family: var(--f-body);
}
/* the kana in a jump chip (ます, ない) take the chosen typeface at the chip's own size */
.fm-jump .chip [lang="ja"] {
  font-size: inherit;
  color: inherit;
}
/* a u-verb's kana of the row in front of the chip's name (か ない, き ます stem) */
.fm-jump .chip .fm-rk {
  margin-right: 5px;
  font-weight: 600;
  color: var(--k2);
}
/* the て form follows a rule of its own: a thin line keeps it apart from the row */
.fm-jump .fm-jte {
  position: relative;
  margin-left: 11px;
}
.fm-jump .fm-jte::before {
  content: "";
  position: absolute;
  left: -9px;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: var(--rule);
}
/* "か row" before a section's title */
.fm-rtag {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  padding: 1px 8px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font: 500 0.72rem/1.5 var(--f-body);
  color: var(--ink-2);
}
.fm-rtag b {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--k2);
}
/* the て strip: the five endings, the verb's own marked */
.fm-strip.te {
  margin-bottom: 12px;
}
.fm-strip.te > div {
  flex: 1 1 0;
  min-width: 0;
}
.fm-strip.te .k {
  font-size: 1.1rem;
  white-space: nowrap;
}
.fm-strip.te .fm-j {
  color: var(--k2);
  font-size: 0.95rem;
}
.fm-strip.te .me {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}
.fm-strip.te .me .fm-x {
  color: var(--ink);
}
.fm-sec > .fm-tap {
  margin: 0 0 6px;
}
.fm-teex {
  margin: -4px 0 12px;
}
.fm-strip.te.one > div {
  flex: 0 1 9rem;
}
.fm-sec {
  scroll-margin-top: 64px;
}
/* the Forms filter chips read in the body font, like the rest of the page */
.fm-filt .chip {
  font-family: var(--f-body);
}
/* the form inside its example sentence */
.fm-hl {
  background: none;
  color: var(--k2);
  font-weight: 600;
}
.fm-page > .fm-card + .fm-card {
  margin-top: -10px;
}
/* the cards under the header: about this word, its pair, a look-alike */
.fm-card {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--surface);
}
.fm-card p {
  margin: 0;
  line-height: 1.6;
}
.fm-cap {
  margin: 0;
  font: 600 0.72rem/1 var(--f-body);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.fm-about {
  border-color: color-mix(in srgb, var(--mark) 70%, var(--rule));
  background: color-mix(in srgb, var(--mark) 14%, var(--surface));
}
:root[data-theme="dark"] .fm-about {
  border-color: color-mix(in srgb, var(--mark) 45%, var(--rule));
  background: color-mix(in srgb, var(--mark) 8%, var(--surface));
}
.fm-sides {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.fm-side {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--rule);
  border-radius: 10px;
}
.fm-side.on {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--rule));
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}
.fm-card .fm-sw {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.4rem;
  line-height: 1.5;
}
.fm-sw rt {
  font-size: 0.42em;
}
.fm-card .fm-sh {
  font-size: 0.9rem;
  line-height: 1.45;
}
.fm-ss {
  display: grid;
  gap: 1px;
  color: var(--ink-2);
  font-size: 0.85rem;
  line-height: 1.45;
}
.fm-ss [lang="ja"] {
  color: var(--ink);
  font-size: 1rem;
}
.fm-side .fm-go {
  align-self: flex-start;
  margin-top: auto;
  padding: 5px 10px;
  font-size: 0.85rem;
}
.fm-card .fm-rule {
  padding-top: 10px;
  border-top: 1px dashed var(--rule);
  color: var(--ink-2);
  font-size: 0.9rem;
  line-height: 1.55;
}
/* the particle a pair's verb takes: が or を */
.fm-pt {
  display: inline-grid;
  place-items: center;
  min-width: 1.6em;
  height: 1.6em;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--mark);
  color: var(--mark-ink);
  font: 500 0.62em/1 var(--f-kana);
  font-style: normal;
}
/* the Pairs list: a pair a row, two tiles, several rows side by side on a computer */
.fm-phead {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 0;
  color: var(--ink-2);
  font-size: 0.85rem;
}
.fm-phead > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.fm-phead .fm-pt {
  font-size: 0.9rem;
}
.fm-pairs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 8px 14px;
}
.fm-prow {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.fm-ptile {
  padding-inline: 2.2rem;
}
.fm-ptile .fm-pt {
  position: absolute;
  top: 9px;
  right: 9px;
  font-size: 0.8rem;
}
.fm-tile.off,
.fm-tile.off:hover {
  cursor: default;
  border-color: var(--rule);
  background: var(--surface);
  opacity: 0.7;
}
.fm-go [lang="ja"],
.fm-nw {
  white-space: nowrap;
}
/* phones: the two words of a card one above the other */
@media (max-width: 520px) {
  .fm-sides {
    grid-template-columns: minmax(0, 1fr);
  }
}
.fm-word {
  margin: 0;
  font-size: 2.4rem;
  line-height: 1.25;
  font-weight: 500;
}
.fm-word rt {
  font-size: 0.34em;
}
.fm-rd,
.fm-mean,
.fm-grp {
  margin: 0;
}
.fm-rd {
  color: var(--ink-2);
}
.fm-mean {
  margin-top: 2px;
  font-size: 1.1rem;
}
.fm-grp {
  justify-self: start;
  margin-top: 8px;
  padding: 3px 11px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.82rem;
  color: var(--ink-2);
}
/* how the word works, and its row of kana */
.fm-how {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}
.fm-how p {
  margin: 0;
  line-height: 1.6;
}
.fm-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 6px;
}
.fm-strip > div,
.fm-strip > button {
  flex: 1 1 4.6rem;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 4px;
  padding: 8px 4px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--surface);
  text-align: center;
}
.fm-strip .k {
  font-size: 1.5rem;
  line-height: 1.2;
}
.fm-strip small {
  font-size: 0.74rem;
  line-height: 1.3;
  color: var(--ink-2);
}
/* the kana of the row are buttons: the one tapped is marked, its forms show under the row */
.fm-strip > button {
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.fm-strip > button:hover {
  border-color: var(--accent);
}
.fm-strip > button[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}
.fm-tap {
  margin: 0;
}
.fm-pick {
  border-top: 1px solid var(--rule);
}
.fm-pick .fm-r:last-child {
  border-bottom: 0;
}
.fm-strip .fm-j {
  color: var(--ink);
  font-size: 0.82rem;
}
/* on a computer the dictionary cell says it in full below; "dict." is for phones */
.fm-strip .me .fm-j:not([lang]) {
  display: none;
}
.fm-stem {
  flex: 0 0 auto;
  align-self: center;
  padding: 0 4px;
  font-size: 1.5rem;
}
.fm-strip.ru > div {
  flex: 0 1 auto;
  padding: 8px 14px;
}
.fm-strip.ru .go .k,
.fm-strip.u .k {
  color: var(--k2);
}
.fm-strip.u .fm-stem,
.fm-strip.ru > div:first-child .k {
  color: var(--ink);
}
/* the forms, a section each: a yellow mark before the title, the line under it, then the rows */
.fm-sec {
  margin-top: 6px;
}
.fm-sec h4 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 4px;
  font-size: 1.12rem;
  line-height: 1.35;
}
.fm-sec h4::before {
  content: "";
  flex: 0 0 auto;
  align-self: stretch;
  width: 4px;
  margin: 3px 0;
  border-radius: 2px;
  background: var(--mark);
}
.fm-sec > .meta {
  margin: 0 0 10px;
  line-height: 1.55;
}
.fm-rows {
  border-top: 1px solid var(--rule);
}
.fm-r {
  display: grid;
  grid-template-columns: minmax(0, 12rem) minmax(0, 1fr);
  gap: 4px 20px;
  align-items: baseline;
  padding: 12px 4px;
  border-bottom: 1px solid var(--rule);
}
.fm-l {
  color: var(--ink-2);
  font-size: 0.88rem;
  line-height: 1.4;
}
.fm-rl {
  margin-left: 4px;
  padding: 0 6px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font: 600 0.66rem/1.5 var(--f-body);
  font-style: normal;
  color: var(--ink-2);
  white-space: nowrap;
}
/* a form reads like a lesson line: the form, its rōmaji under it, what it means, then a sentence */
.fm-f {
  display: grid;
  justify-items: start;
  gap: 1px;
  min-width: 0;
}
.fm-f > .rm-s {
  font-size: 0.86rem;
  line-height: 1.4;
}
.fm-mn {
  margin-top: 2px;
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.45;
}
.fm-w {
  font-size: 1.3rem;
  line-height: 1.6;
}
.fm-w rt {
  font-size: 0.45em;
}
.fm-c {
  color: var(--k2);
  font-weight: 600;
}
.fm-alt {
  color: var(--ink-2);
  font-size: 0.85rem;
}
/* a sentence that uses the form (always the page's own word), its meaning under it, with a coloured edge */
.fm-ex {
  justify-self: stretch;
  display: grid;
  gap: 2px;
  margin-top: 6px;
  padding: 6px 10px 7px;
  border-left: 3px solid color-mix(in srgb, var(--accent) 60%, transparent);
  border-radius: 0 8px 8px 0;
  background: color-mix(in srgb, var(--accent) 5%, transparent);
  color: var(--ink-2);
  font-size: 0.86rem;
  line-height: 1.45;
}
.fm-ex [lang="ja"] {
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.55;
}
/* "Hide to test": a form waits behind this until tapped */
.fm-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.fm-bar .sub {
  margin: 0;
}
/* small phones: Show / Hide to test stay one row, side by side under the title */
@media (max-width: 420px) {
  .fm-bar .fm-seg {
    display: flex;
    flex-wrap: nowrap;
    width: 100%;
  }
  .fm-seg button {
    flex: 1 1 auto;
    white-space: normal;
    line-height: 1.25;
  }
}
.fm-cover {
  padding: 4px 12px;
  border: 1px dashed var(--rule);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  color: var(--ink-2);
  font: 500 0.88rem var(--f-body);
  cursor: pointer;
}
.fm-cover:hover {
  border-color: var(--accent);
}
/* the search: chips for words read the same, the chosen word's main forms, a form typed as seen */
.fm-chips .chip small {
  margin-left: 5px;
  font-size: 0.75em;
  color: var(--ink-2);
}
.fm-chips .chip[aria-pressed="true"] small {
  color: inherit;
}
.fm-quick {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--rule);
  border-radius: 12px;
}
.fm-qtop {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
}
.fm-qtop b {
  font-size: 1.6rem;
  font-weight: 500;
}
.fm-quick .btn {
  justify-self: start;
}
.fm-hit {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--accent);
  border-radius: 12px;
}
.fm-hit b {
  font-size: 1.5rem;
  font-weight: 500;
}
.fm-hit > span {
  color: var(--ink-2);
}
.fm-steps {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 1.4em;
}
.fm-steps + .btn {
  justify-self: start;
}
/* the word list's popup: four forms in a row */
.fm-mini {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 4px 0 2px;
}
.fm-mini > div {
  display: grid;
  gap: 2px;
  justify-items: center;
  padding: 6px 2px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  min-width: 0;
}
.fm-mini small {
  color: var(--ink-2);
  font-size: 0.75rem;
}
.fm-mini span {
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}
.fm-mini rt {
  font-size: 0.5em;
}
/* the lessons behind a section's forms, one a line */
.fm-ls {
  display: grid;
  justify-items: start;
  gap: 6px;
  margin: 10px 0 0;
  font-size: 0.88rem;
}
.fm-ls .meta {
  margin: 0;
}
@media (max-width: 600px) {
  .fm-r {
    grid-template-columns: minmax(0, 1fr);
  }
  .fm-word {
    font-size: 2rem;
  }
  /* the row of kana stays one row: five narrow cells, their notes wrapping under them */
  .fm-strip.u {
    flex-wrap: nowrap;
    gap: 4px;
  }
  .fm-strip.u > button {
    flex: 1 1 0;
    min-width: 0;
    padding: 6px 2px;
  }
  .fm-strip.u .fm-x {
    display: none;
  }
  .fm-strip.u .fm-j {
    font-size: 0.74rem;
  }
  .fm-strip .me .fm-j:not([lang]) {
    display: block;
  }
  .fm-strip.u .fm-stem {
    font-size: 1.2rem;
    padding: 0 2px;
  }
  .fm-strip.te {
    flex-wrap: nowrap;
    gap: 4px;
  }
  .fm-strip.te > div {
    padding: 6px 2px;
  }
  .fm-strip.te .k {
    font-size: 0.92rem;
  }
  .fm-strip.te .fm-j {
    font-size: 0.8rem;
  }
  .fm-strip.te .fm-x {
    font-size: 0.68rem;
  }
}
