:root {
  --paper:#f4f2eb;
  --surface:#fffdf7;
  --ink:#263d35;
  --muted:#62716a;
  --jade:#345e50;
  --line:#d6dcd2;
  --soft:#e8eee7;
  --red:#a44b3b;
  --site-font:'KaiTi-CJK','LXGW WenKai Lite',serif;
  color-scheme:light;
}
* {
  box-sizing:border-box;
}
body {
  margin:0;
  background:var(--paper);
  color:var(--ink);
  font:15px/1.6 var(--site-font);
}
button,input {
  font:inherit;
}
button,a,input {
  touch-action:manipulation;
}
button {
  cursor:pointer;
}
button:disabled {
  cursor:default;
  opacity:.45;
}
a {
  color:inherit;
  text-decoration:none;
}
button {
  color:inherit;
}
h1,h2,h3,p {
  margin:0;
}
button:focus-visible,a:focus-visible,input:focus-visible {
  outline:2px solid var(--red);
  outline-offset:4px;
}
[hidden] {
  display:none!important;
}
.sr-only {
  position:absolute;
  width:1px;
  height:1px;
  clip-path:inset(50%);
  overflow:hidden;
  white-space:nowrap;
}
.studio-header {
  max-width:1240px;
  margin:auto;
  padding:12px 0;
  display:grid;
  grid-template-columns:1fr auto 1fr;
  align-items:center;
  gap:24px;
  border-bottom:1px solid var(--line);
}
.back-link {
  justify-self:start;
  display:flex;
  align-items:center;
  gap:9px;
  font-size:13px;
}
button.back-link {
  padding:0;
  border:0;
  background:none;
  text-align:left;
}
.back-link small {
  display:block;
  color:var(--muted);
  font-size:10px;
  line-height:1.2;
}
.wordmark {
  display:flex;
  align-items:center;
  gap:10px;
  font-size:19px;
  letter-spacing:2px;
}
.wordmark small {
  font-size:11px;
  letter-spacing:.5px;
  margin-left:8px;
  color:var(--muted);
}
.seal {
  width:30px;
  height:34px;
  display:inline-grid;
  place-items:center;
  border:1px solid var(--red);
  border-radius:3px;
  color:var(--red);
  font-size:21px;
  flex:none;
}
main {
  max-width:1240px;
  padding-bottom:16px;
  margin:0 auto;
}
.directory-intro {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:24px;
  padding:18px 0 16px;
}
.directory-intro .button {
  flex:none;
}
.eyebrow {
  font-size:10px;
  letter-spacing:1.7px;
  color:var(--muted);
  margin-bottom:8px;
}
h1 {
  font-size:28px;
  letter-spacing:3px;
  font-weight:500;
  line-height:1.4;
}
.intro-copy {
  font-size:14px;
  color:var(--muted);
  margin-top:2px;
}
.intro-copy [lang=en] {
  font-size:12px;
}
.step-heading {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;
}
.step-heading h2 {
  font-size:17px;
  font-weight:500;
}
.step-heading h2>span {
  color:var(--red);
  font-size:12px;
  margin-right:10px;
}
.step-heading small {
  font-size:12px;
  color:var(--muted);
  margin-left:8px;
  font-weight:400;
}
.grade-list {
  display:grid;
  grid-template-columns:repeat(5,minmax(0,1fr));
  gap:10px;
  margin-bottom:22px;
}
.grade-card {
  position:relative;
  text-align:left;
  border:1px solid var(--line);
  background:var(--surface);
  border-radius:4px;
  padding:9px 16px;
  display:flex;
  align-items:center;
  gap:12px;
  min-height:58px;
}
.grade-card>strong {
  font-size:26px;
  line-height:1.2;
  font-weight:400;
  color:var(--jade);
}
.grade-card span {
  display:block;
  font-size:15px;
}
.grade-card small {
  display:block;
  color:var(--muted);
  font-size:11px;
}
.grade-card::after {
  content:'↗';
  margin-left:auto;
  font-size:17px;
  color:var(--muted);
}
.grade-card:hover {
  border-color:var(--jade);
}
.grade-card[aria-pressed=true] {
  border-color:var(--jade);
  background:var(--soft);
  box-shadow:inset 0 -2px var(--jade);
}
.directory-panel {
  border:1px solid var(--line);
  border-top:2px solid var(--jade);
  border-radius:4px;
  background:var(--surface);
}
.roster-toolbar {
  padding:18px 20px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
}
.roster-toolbar h2 {
  font-size:18px;
  font-weight:500;
}
.roster-toolbar h2 small {
  font-size:12px;
  color:var(--muted);
  font-weight:400;
  margin-left:8px;
}
.roster-toolbar p {
  font-size:12px;
  color:var(--muted);
  margin-top:3px;
}
.search-field {
  display:flex;
  align-items:center;
  border:1px solid var(--line);
  border-radius:4px;
  padding:6px 10px;
  gap:8px;
  width:280px;
  max-width:100%;
  background:#fffef9;
}
.search-field:focus-within {
  border-color:var(--jade);
}
.search-field>span {
  font-size:23px;
  line-height:1;
  color:var(--muted);
}
.search-field input {
  background:none;
  border:0;
  outline:none;
  min-width:0;
  width:100%;
  color:var(--ink);
  font-size:13px;
}
.alphabet {
  display:flex;
  flex-wrap:wrap;
  gap:4px;
  padding:0 20px 14px;
}
.alphabet button {
  min-width:30px;
  min-height:30px;
  padding:3px 7px;
  border:1px solid transparent;
  border-radius:3px;
  background:none;
  font-size:12px;
  color:var(--muted);
}
.alphabet button:first-child {
  min-width:44px;
}
.alphabet button[aria-pressed=true] {
  color:#fffef7;
  background:var(--jade);
}
.alphabet button:disabled {
  opacity:.25;
}
.list-head,.student-row {
  display:grid;
  grid-template-columns:minmax(0,1.1fr) minmax(0,1fr) 110px;
  gap:20px;
  align-items:center;
}
.list-head {
  padding:8px 20px;
  border-top:1px solid var(--line);
  border-bottom:1px solid var(--line);
  background:#f1f3ec;
  font-size:10px;
  letter-spacing:.7px;
  color:var(--muted);
}
.student-row {
  width:100%;
  border:0;
  border-bottom:1px solid #e8ebe3;
  background:none;
  padding:11px 20px;
  text-align:left;
}
.student-row:last-child {
  border-bottom:0;
}
.student-row:hover {
  background:#f1f5ed;
}
.english-name {
  display:flex;
  align-items:center;
  min-width:0;
  font-size:15px;
}
.english-name strong {
  font-weight:600;
}
.avatar {
  position:relative;
  display:inline-grid;
  place-items:center;
  flex:none;
  overflow:hidden;
  border:1px solid var(--line);
  border-radius:50%;
  background:var(--soft);
  color:var(--jade);
  vertical-align:middle;
}
.avatar img {
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:cover;
}
.roster-avatar {
  width:36px;
  height:36px;
  font-size:13px;
  margin-right:12px;
}
.roster-chinese {
  display:flex;
  align-items:baseline;
  flex-wrap:wrap;
  gap:12px;
}
.roster-chinese strong {
  font-size:18px;
  letter-spacing:2px;
  font-weight:500;
}
.roster-chinese small {
  font-size:12px;
  color:var(--muted);
}
.row-action {
  font-size:12px;
  color:var(--jade);
  text-align:right;
}
.directory-empty {
  padding:24px;
  text-align:center;
  color:var(--muted);
}
.empty-mark {
  display:block;
  color:#8b9c8d;
  font-size:32px;
  margin-bottom:4px;
}
.directory-empty h3 {
  font-size:17px;
  font-weight:500;
  color:var(--ink);
  margin-bottom:4px;
}
.directory-empty p {
  font-size:12px;
  line-height:1.9;
}
.directory-empty p [lang=en] {
  font-size:11px;
}
.directory-bottom {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:10px 20px;
  border-top:1px solid var(--line);
  font-size:11px;
  color:var(--muted);
}
.text-button {
  padding:5px 0;
  background:none;
  border:0;
  font-size:12px;
  color:var(--jade);
}
.learning-notes {
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:30px;
  margin:24px 0 16px;
}
.learning-notes article {
  display:flex;
  gap:14px;
}
.learning-notes article>span {
  font-size:20px;
  color:var(--red);
}
.learning-notes h3 {
  font-size:15px;
  font-weight:500;
}
.learning-notes h3 small {
  font-size:11px;
  font-weight:400;
  color:var(--muted);
  margin-left:5px;
}
.learning-notes p {
  font-size:12px;
  color:var(--muted);
  margin-top:3px;
}
.identity-bar {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px 18px;
  padding:10px 0;
  border-bottom:1px solid var(--line);
}
.identity-avatar-slot {
  display:flex;
  flex:none;
}
.identity-avatar {
  width:58px;
  height:58px;
  font-size:26px;
  border-color:#bccabb;
}
.identity-name {
  display:flex;
  flex-direction:column;
  min-width:0;
}
.identity-line {
  display:flex;
  flex-wrap:wrap;
  align-items:baseline;
  gap:0 16px;
}
.listen-button {
  display:inline-flex;
  align-items:center;
  gap:6px;
  min-height:38px;
  padding:6px 14px;
  border:1px solid #bbc9b7;
  border-radius:999px;
  background:#f1f4ec;
  color:var(--jade);
  font-size:14px;
}
.listen-button svg {
  width:18px;
  height:18px;
}
.listen-button small {
  font-size:11px;
  color:var(--muted);
}
.listen-button:hover,.character-listen:hover {
  border-color:var(--jade);
}
.listen-button.speaking,.character-listen.speaking {
  border-color:var(--jade);
  background:var(--jade);
  color:#fffef8;
}
.listen-button.speaking small {
  color:inherit;
}
.identity-bar h1 {
  font-size:30px;
  letter-spacing:6px;
  line-height:1.3;
}
.identity-pinyin {
  color:var(--jade);
  font-size:17px;
  letter-spacing:2px;
}
.identity-detail {
  font-size:13px;
}
.identity-detail small {
  font-size:12px;
  color:var(--muted);
  margin-left:10px;
}
.identity-detail small:empty {
  display:none;
}
#practice-view {
  --meaning-width:360px;
  --practice-gap:24px;
}
.practice-tabs {
  display:grid;
  grid-template-columns:repeat(2,var(--meaning-width));
  justify-content:start;
  gap:var(--practice-gap);
  margin:0;
  padding:8px 0 0;
  border:0;
}
.practice-tabs button {
  min-height:46px;
  padding:9px 14px;
  border:1px solid var(--line);
  border-radius:6px;
  background:var(--surface);
  font-size:17px;
  color:var(--jade);
}
.practice-tabs button[aria-selected=true] {
  border-color:var(--jade);
  background:var(--jade);
  color:#fffef8;
}
.practice-tabs button:hover:not([aria-selected=true]) {
  border-color:#a9bfad;
  background:var(--soft);
}
.practice-tabs small {
  margin-left:7px;
  font-size:11px;
  color:inherit;
}
.writing-layout {
  --board:clamp(280px,var(--board-fit,calc(100dvh - 270px)),460px);
  display:grid;
  grid-template-columns:var(--meaning-width) minmax(0,1fr);
  gap:var(--practice-gap);
  align-items:start;
  margin-top:16px;
}
.character-card {
  position:relative;
  margin-bottom:8px;
}
.character-button {
  width:100%;
  display:flex;
  align-items:flex-start;
  gap:14px;
  padding:10px 52px 10px 14px;
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:4px;
  text-align:left;
}
.character-button[aria-pressed=true] {
  background:var(--soft);
  border-color:var(--jade);
  box-shadow:inset 3px 0 var(--jade);
}
.character-button .glyph {
  font-size:34px;
  line-height:1.2;
  flex:none;
}
.character-copy {
  display:flex;
  flex-direction:column;
  min-width:0;
  padding-top:2px;
}
.character-meta {
  font-size:12px;
  color:var(--muted);
}
.character-meta strong {
  font-size:15px;
  font-weight:500;
  color:var(--jade);
}
.character-zh {
  font-size:14px;
  line-height:1.6;
  margin-top:2px;
  overflow-wrap:anywhere;
}
.character-en {
  font-size:12px;
  line-height:1.5;
  color:var(--muted);
  overflow-wrap:anywhere;
}
.character-meta .char-check {
  color:var(--jade);
  margin-left:6px;
}
.character-listen {
  position:absolute;
  right:10px;
  top:50%;
  transform:translateY(-50%);
  display:grid;
  place-items:center;
  width:34px;
  height:34px;
  padding:0;
  border:1px solid #bbc9b7;
  border-radius:50%;
  background:#f1f4ec;
  color:var(--jade);
}
.character-listen svg {
  width:17px;
  height:17px;
}
.character-rail {
  display:flex;
  flex-direction:column;
  gap:8px;
  min-width:0;
}
/* The reference takes whatever height the cards leave beside the board. */
.stroke-reference {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin:0;
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:4px;
  background:var(--surface);
}
.stroke-reference figcaption {
  display:flex;
  flex-direction:column;
  gap:2px;
  min-width:0;
  font-size:13px;
  color:var(--muted);
}
.stroke-reference figcaption small { font-size:11px; }
.reference-box {
  width:170px;
  height:170px;
  max-width:100%;
  aspect-ratio:1;
  flex:none;
  border:1px solid #d8b56f;
  border-radius:4px;
  background:#fffef9;
}
.reference-box svg {
  display:block;
  width:100%;
  height:100%;
}
.writing-workspace {
  min-width:0;
  padding:18px;
  border:1px solid var(--line);
  border-top:2px solid var(--jade);
  border-radius:4px;
  background:var(--surface);
}
.mode-switch,.typing-options {
  display:flex;
  gap:4px;
  flex-wrap:wrap;
}
.mode-switch button,.typing-options button {
  border:1px solid var(--line);
  background:none;
  border-radius:3px;
  padding:6px 10px;
  font-size:12px;
  color:var(--muted);
}
.mode-switch button[aria-pressed=true],.typing-options button[aria-pressed=true] {
  border-color:var(--jade);
  background:var(--soft);
  color:var(--jade);
}
.board-layout {
  display:grid;
  grid-template-columns:minmax(0,1fr) 220px;
  gap:24px;
  align-items:center;
}
.writing-guide {
  display:flex;
  flex-direction:column;
  gap:12px;
  min-width:0;
}
.guide-title {
  display:flex;
  flex-direction:column;
  gap:4px;
  font-size:19px;
  font-weight:500;
}
.guide-title small {
  font-size:12px;
  font-weight:400;
  color:var(--muted);
}
.guide-label {
  margin-top:8px;
  font-size:10px;
  letter-spacing:1px;
  color:var(--muted);
}
#stroke-progress {
  display:block;
  font-size:28px;
  font-weight:400;
  line-height:1.2;
}
.progress-track {
  height:4px;
  background:#e1e6dc;
}
.writing-guide>p {
  font-size:13px;
  color:var(--muted);
  line-height:1.7;
  min-height:44px;
}
.writing-guide>.name-progress {
  font-size:11px;
  min-height:0;
}
.board-column {
  width:min(100%,var(--board));
  min-width:0;
  margin-inline:auto;
}
.writer-box {
  position:relative;
  width:100%;
  aspect-ratio:1;
  border:1px solid #b8c6b4;
  background-color:#fffef9;
  background-image:linear-gradient(90deg,transparent calc(50% - .5px),#d5dbce 50%,transparent calc(50% + .5px)),linear-gradient(0deg,transparent calc(50% - .5px),#d5dbce 50%,transparent calc(50% + .5px)),linear-gradient(45deg,transparent calc(50% - .5px),#e4e6db 50%,transparent calc(50% + .5px)),linear-gradient(-45deg,transparent calc(50% - .5px),#e4e6db 50%,transparent calc(50% + .5px));
  touch-action:none;
}
#writer {
  position:absolute;
  inset:0;
}
#writer svg {
  display:block;
  max-width:100%;
  height:auto;
}
.writer-loading {
  position:absolute;
  inset:0;
  display:grid;
  place-items:center;
  padding:20px;
  text-align:center;
  color:var(--muted);
  font-size:13px;
  background:#fffef9ed;
  pointer-events:none;
}
.writer-loading button {
  pointer-events:auto;
}
.board-actions {
  display:flex;
  gap:8px;
}
.button {
  border:1px solid #bbc9b7;
  border-radius:4px;
  background:#f1f4ec;
  color:var(--jade);
  padding:8px 13px;
  min-height:38px;
  font-size:13px;
}
.button small {
  font-size:11px;
  margin-left:4px;
}
.button.primary {
  border-color:var(--jade);
  background:var(--jade);
  color:#fffef8;
}
.button:hover:not(:disabled) {
  filter:brightness(.96);
}
.board-actions .button {
  flex:1;
  padding:8px 6px;
  white-space:nowrap;
}
.writing-guide {
  container-type:inline-size;
}
@container (max-width:250px) {
  .board-actions .button small {
    display:none;
  }
}
.progress-track>span {
  display:block;
  width:0;
  height:100%;
  background:var(--jade);
  transition:width .2s;
}
.typing-layout {
  display:grid;
  grid-template-columns:minmax(0,1fr) 300px;
  gap:20px;
}
.typing-workspace {
  border:1px solid var(--line);
  border-top:2px solid var(--jade);
  border-radius:4px;
  background:var(--surface);
  padding:28px;
}
.typing-workspace h2 {
  font-size:25px;
  font-weight:500;
}
.typing-options {
  margin-top:18px;
}
.typing-target {
  font-size:35px;
  letter-spacing:5px;
  margin:24px 0 12px;
}
.typing-label {
  display:block;
  font-size:13px;
  color:var(--muted);
  margin-bottom:8px;
}
.typing-input {
  display:block;
  width:100%;
  border:1px solid #a6baa6;
  border-radius:4px;
  padding:12px 14px;
  background:#fffefb;
  font-size:23px;
  color:var(--ink);
  min-height:59px;
  user-select:text;
}
.typing-actions {
  display:flex;
  gap:8px;
  margin-top:14px;
}
.typing-feedback {
  font-size:14px;
  color:var(--jade);
  margin-top:14px;
  min-height:25px;
}
.typing-guide {
  border-left:1px solid var(--line);
  padding:12px 0 12px 24px;
}
.typing-guide h3 {
  font-size:18px;
  font-weight:500;
  margin-top:16px;
}
#typing-syllables {
  display:flex;
  flex-wrap:wrap;
  gap:18px;
  margin:16px 0;
}
#typing-syllables span {
  display:flex;
  flex-direction:column;
  align-items:center;
  font-size:24px;
}
#typing-syllables small {
  font-size:13px;
  color:var(--jade);
}
.typing-guide p {
  font-size:13px;
  color:var(--muted);
  line-height:1.9;
}
.typing-guide .typing-tip {
  font-size:11px;
  margin-top:16px;
  padding-top:12px;
  border-top:1px solid var(--line);
}
dialog {
  width:min(440px,calc(100% - 32px));
  border:1px solid var(--line);
  border-top:3px solid var(--red);
  border-radius:5px;
  background:var(--surface);
  padding:24px;
  color:var(--ink);
}
dialog::backdrop {
  background:#263d3544;
}
.dialog-heading {
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.dialog-heading h2 {
  font-size:23px;
  font-weight:500;
}
.dialog-heading button {
  font-size:26px;
  padding:0 6px;
}
dialog p {
  font-size:13px;
  color:var(--muted);
  margin:10px 0;
}
dialog label {
  display:block;
  font-size:14px;
  margin-top:16px;
}
dialog label small {
  font-size:11px;
  color:var(--muted);
}
dialog input {
  display:block;
  width:100%;
  padding:9px 11px;
  border:1px solid var(--line);
  border-radius:4px;
  background:white;
  margin-top:6px;
  color:var(--ink);
}
dialog .primary {
  margin-top:10px;
  width:100%;
}
#custom-error {
  color:var(--red);
}
@media(max-width:1300px) {
  .studio-header,main {
    width:calc(100% - 48px);
  }
}
@media(max-width:1000px) {
  .grade-card {
    padding:10px 12px;
    gap:8px;
  }
  .grade-card::after {
    display:none;
  }
  .writing-layout {
    --board:clamp(260px,calc(100vh - 560px),380px);
    grid-template-columns:minmax(0,1fr);
    justify-content:stretch;
    gap:14px;
  }
  .board-layout {
    gap:18px;
    grid-template-columns:var(--board) minmax(0,1fr);
  }
  .practice-tabs {
    margin-left:0;
    flex-basis:100%;
  }
  .learning-notes {
    gap:16px;
  }
  .learning-notes h3 small {
    display:block;
    margin-left:0;
  }
  .typing-layout {
    grid-template-columns:minmax(0,1fr) 240px;
  }
  .typing-workspace {
    padding:20px;
  }
}
@media(max-width:700px) {
  .studio-header,main {
    width:calc(100% - 28px);
  }
  .studio-header {
    padding:13px 0;
    gap:12px;
  }
  .wordmark {
    font-size:17px;
    letter-spacing:1px;
  }
  .wordmark small {
    display:none;
  }
  .back-link {
    font-size:12px;
  }
  .seal {
    width:27px;
    height:31px;
    font-size:19px;
  }
  .directory-intro {
    padding:14px 0;
    gap:10px;
    flex-direction:column;
    align-items:stretch;
  }
  h1 {
    font-size:23px;
    letter-spacing:1px;
  }
  .eyebrow {
    font-size:9px;
    letter-spacing:.7px;
  }
  .intro-copy {
    font-size:13px;
  }
  .intro-copy [lang=en] {
    font-size:11px;
  }
  .step-heading small {
    font-size:11px;
    margin-left:5px;
  }
  .grade-list {
    gap:7px;
  }
  .grade-card {
    display:block;
    min-height:66px;
    padding:6px 4px;
    text-align:center;
  }
  .grade-card>strong {
    font-size:22px;
  }
  .grade-card span {
    font-size:11px;
  }
  .grade-card small {
    font-size:9px;
  }
  .roster-toolbar {
    padding:14px;
    flex-direction:column;
    align-items:stretch;
    gap:10px;
  }
  .roster-toolbar h2 {
    font-size:17px;
  }
  .search-field {
    width:100%;
  }
  .alphabet {
    padding:0 10px 12px;
    gap:2px;
  }
  .alphabet button {
    min-width:29px;
    min-height:32px;
  }
  .list-head,.student-row {
    grid-template-columns:minmax(0,1fr) minmax(0,1fr) 20px;
    gap:8px;
    padding-left:12px;
    padding-right:12px;
  }
  .list-head {
    font-size:8px;
    letter-spacing:0;
  }
  .english-name {
    font-size:12px;
  }
  .roster-avatar {
    width:30px;
    height:30px;
    margin-right:8px;
  }
  .roster-chinese {
    gap:1px;
    flex-direction:column;
    align-items:flex-start;
  }
  .roster-chinese strong {
    font-size:17px;
  }
  .roster-chinese small {
    font-size:11px;
  }
  .row-action .action-label {
    display:none;
  }
  .row-action {
    font-size:18px;
  }
  .directory-bottom {
    padding:10px 12px;
    gap:10px;
  }
  .directory-bottom>span {
    font-size:10px;
    max-width:65%;
  }
  .directory-bottom .text-button {
    font-size:11px;
    white-space:nowrap;
  }
  .learning-notes {
    grid-template-columns:1fr;
    gap:14px;
    margin-top:20px;
  }
  .learning-notes h3 small {
    display:inline;
    margin-left:5px;
  }
  .learning-notes article {
    gap:12px;
  }
  .identity-bar {
    gap:6px 12px;
    padding:10px 0;
  }
  .identity-avatar {
    width:54px;
    height:54px;
    font-size:24px;
  }
  .identity-name {
    flex:1;
  }
  .listen-button {
    padding:5px 11px;
    font-size:13px;
  }
  .listen-button small {
    display:none;
  }
  .identity-bar h1 {
    font-size:26px;
    letter-spacing:3px;
  }
  .identity-pinyin {
    font-size:14px;
    letter-spacing:1px;
  }
  .identity-detail {
    font-size:12px;
  }
  .identity-detail small {
    font-size:11px;
  }
  .practice-tabs {
    gap:20px;
    border-bottom:1px solid var(--line);
  }
  .practice-tabs button {
    font-size:15px;
  }
  .practice-tabs small {
    font-size:10px;
    margin-left:3px;
  }
  .writing-layout {
    grid-template-columns:1fr;
    gap:14px;
  }
  .stroke-reference {
    display:none;
  }
  .character-card {
    margin-bottom:6px;
  }
  .character-button {
    gap:10px;
    padding:7px 46px 7px 10px;
  }
  .character-button .glyph {
    font-size:26px;
  }
  .character-zh {
    font-size:13px;
  }
  .character-en {
    font-size:11px;
  }
  .character-listen {
    width:30px;
    height:30px;
    right:8px;
  }
  .writing-workspace {
    padding:14px;
  }
  .mode-switch button {
    font-size:11px;
    padding:5px 8px;
  }
  .board-layout {
    grid-template-columns:minmax(0,1fr);
    gap:18px;
  }
  .board-column {
    width:100%;
    max-width:360px;
    margin:auto;
  }
  .writing-guide {
    gap:8px;
  }
  .guide-label {
    margin-top:0;
  }
  #stroke-progress {
    font-size:22px;
  }
  .writing-guide>p {
    min-height:0;
  }
  .typing-layout {
    grid-template-columns:1fr;
  }
  .typing-workspace {
    padding:18px;
  }
  .typing-workspace h2 {
    font-size:21px;
  }
  .typing-guide {
    border-left:0;
    border-top:1px solid var(--line);
    padding:16px 0;
  }
  .typing-target {
    font-size:29px;
    letter-spacing:2px;
  }
  .typing-options button {
    font-size:11px;
  }
  .typing-input {
    font-size:21px;
  }
}
@media(prefers-reduced-motion:reduce) {
  .progress-track>span {
    transition:none;
  }
}

/* Name meanings and feedback remain quiet, readable parts of the workbench. */
.whole-name-meaning { padding:4px 2px; margin-top:4px; border-top:1px solid var(--line); font-size:12px; color:var(--muted); line-height:1.7; overflow-wrap:anywhere; }
.whole-name-meaning strong { font-weight:500; color:var(--jade); }
.roster-support {
  margin:12px 0 0;
  padding:0;
  font-size:12px;
  color:var(--muted);
}
.roster-support strong { font-size:13px; font-weight:500; }
.roster-support p { font-size:12px; color:var(--muted); margin-top:4px; line-height:1.7; }
.roster-support p [lang=en] { font-size:11px; }
.roster-support button { flex:none; }
.stroke-hint { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }
.stroke-replay { font-size:12px; }
.typing-review { margin-top:18px; padding:12px; border:1px solid var(--line); border-radius:4px; background:#f9f9f1; }
.typing-review>p { font-size:11px; color:var(--muted); margin-bottom:10px; }
.typing-review>small { display:block; font-size:11px; color:var(--muted); margin-top:8px; }
.typing-review-items { display:flex; flex-wrap:wrap; gap:5px; align-items:flex-start; }
.review-token { display:flex; flex-direction:column; align-items:center; min-width:26px; gap:3px; }
.review-token strong { display:block; min-width:26px; padding:2px 4px; font-size:20px; line-height:1.5; text-align:center; font-weight:500; border-bottom:2px solid transparent; }
.review-token small { font-size:10px; color:#94402e; white-space:nowrap; }
.review-token.correct strong { color:var(--jade); }
.review-token.incorrect strong { color:#a23527; background:#fae8e1; border-bottom-color:#a23527; border-radius:2px; }
.review-token.missing strong { border:1px dashed #a23527; padding:1px 3px; }
.review-token.extra strong { text-decoration:line-through; }
.typing-input[aria-invalid=true] { border-color:#a23527; }
#enroll-dialog { width:min(590px,calc(100% - 28px)); max-height:calc(100dvh - 40px); overflow-y:auto; }
.enroll-grid { display:grid; grid-template-columns:1fr 1fr; gap:0 14px; }
#enroll-dialog :is(select,textarea) { font:inherit; width:100%; min-width:0; padding:9px 11px; margin-top:6px; border:1px solid var(--line); border-radius:4px; background:white; color:var(--ink); }
#enroll-dialog textarea { resize:vertical; }
#enroll-dialog .enroll-note { font-size:11px; }
#enroll-error { color:var(--red); }
@media(max-width:700px) {
  .roster-support { flex-direction:column; align-items:flex-start; gap:10px; padding:12px; }
  .review-token strong { font-size:19px; }
}
@media(max-width:380px) {
  .enroll-grid { grid-template-columns:1fr; }
}

/* Match the workspace hierarchy on small laptops, tablets, and phones. */
@media(min-width:1001px) {
  #practice-view { max-width:1160px; margin-inline:auto; }
}
@media(min-width:901px) and (max-width:1100px) {
  #practice-view { --meaning-width:250px; --practice-gap:16px; }
  .writing-layout { grid-template-columns:var(--meaning-width) minmax(0,1fr); gap:var(--practice-gap); }
  .board-layout { grid-template-columns:minmax(0,1fr) 180px; gap:16px; }
  .writing-workspace { padding:14px; }
  .reference-box { width:160px; height:160px; }
}
@media(max-width:1000px) {
  .writing-layout { --board:clamp(280px,var(--board-fit,calc(100dvh - 270px)),460px); }
}
@media(max-width:900px) {
  .practice-tabs { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
  .writing-layout { grid-template-columns:minmax(0,1fr); gap:16px; }
  .character-rail { display:grid; grid-template-columns:minmax(0,1fr) 180px; gap:14px; }
  #character-list { display:grid; grid-template-columns:repeat(auto-fit,minmax(190px,1fr)); gap:8px; align-content:start; }
  .character-card { margin:0; }
  .reference-box { width:150px; height:150px; }
  .board-layout { grid-template-columns:minmax(0,1fr) 210px; gap:20px; }
}
@media(max-width:700px) {
  .studio-header { grid-template-columns:auto minmax(0,1fr); }
  .wordmark { justify-self:end; }
  .practice-tabs { width:100%; gap:8px; border:0; }
  .practice-tabs button { font-size:16px; padding:7px 8px; }
  .practice-tabs small { display:block; margin:2px 0 0; font-size:10px; }
  .character-rail { display:block; }
  .stroke-reference { display:none; }
  #character-list { grid-template-columns:minmax(0,1fr); gap:6px; }
  .writing-workspace { padding:14px; }
  .board-layout { grid-template-columns:minmax(0,1fr); gap:18px; }
  .board-column { width:min(100%,380px); }
  .writing-guide { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:10px; }
  .guide-title { grid-column:1/-1; flex-direction:row; flex-wrap:wrap; gap:8px; }
  .writing-guide .mode-switch { grid-column:1/-1; }
  .writing-guide .guide-label { align-self:center; margin:0; }
  .writing-guide :is(.progress-track,#writing-feedback,.stroke-replay,.board-actions,#next-character,.name-progress) { grid-column:1/-1; }
  .writing-guide #stroke-progress { font-size:24px; }
  .roster-support { display:block; margin:10px 0 0; padding:0; }
  .roster-support span { margin-left:4px; }
}

/* Keep the stroke reference in view even for unusually long name meanings.
   The full wording remains readable in its own scrolling list. */
@media(min-width:901px) {
  .character-rail { max-height:calc(var(--board) + 38px); }
  #character-list { min-height:0; overflow-y:auto; scrollbar-width:thin; overscroll-behavior:contain; }
  .stroke-reference { flex:none; }
}

@media(min-width:701px) and (max-width:900px) {
  .stroke-reference { flex-direction:column; align-items:center; gap:8px; }
  .stroke-reference figcaption { width:100%; flex-direction:row; gap:8px; }
}
