.pinyin-raw .char {
    margin-bottom: 6px;
    margin-right: 3px;
}

.pinyin-raw .char {
    padding: 4px 1px;
    border: 1px solid #f7f7f7;
    border-radius: 5px;
}

.pinyin-raw .char .code,
.pinyin-raw .word .display {
    display: none;
}

.pinyin-raw .char {
    font-size: 22px;
    line-height: 1;
}

.pinyin-raw .word {
    background-color: transparent;
    border: none;
    padding: 0;
    margin: 0;
    font-family: 'Roboto Mono', monospace;
    letter-spacing: 0;
}

.pinyin-raw .char .text {
    color: var(--theme-text);
    /* Uniform cell: ASCII consonants/space render in Roboto Mono (~0.6em advance);
       toned vowels fall back to a proportional font — centre them in the same box so
       every cell (incl. space) shares one width, matching the English monospace grid. */
    display: inline-block;
    width: 0.6em;
    text-align: center;
}

.pinyin-raw .word .display.current,
.pinyin-raw .char.current {
    border: 1px solid var(--theme-accent);
    box-shadow: 0 0 2px rgba(125, 125, 125, .7);
    z-index: 1000;
}

/* ── Compositor cursor (live typing; replaces per-char .current border) ──
   Mirrors the English R14 shell: idle = accent box + blink; burst = outline only. */
.pinyin-raw .article.compositor-cursor-active:not(.burst-typing) .typing-cursor-shell {
    border: 1px solid var(--theme-accent, #365A92);
    border-radius: 5px;
    box-shadow: 0 0 2px rgba(125, 125, 125, .7);
    outline: none;
    animation: blinking-cursor 1s ease-in-out infinite;
    will-change: opacity;
}

.pinyin-raw .article.burst-typing.compositor-cursor-active .typing-cursor-shell {
    border: none;
    border-radius: 0;
    outline: 1px solid var(--theme-accent, #365A92);
    outline-offset: 0;
    box-shadow: none;
    animation: none;
    opacity: 1;
    will-change: auto;
    background: transparent;
}

.pinyin-raw .article.burst-typing .char.current {
    border: 1px solid #f7f7f7;
    box-shadow: none;
    z-index: auto;
}

.pinyin-raw-container {
    overflow-y: hidden !important;
}

.pinyin-raw .char.space .text::after {
    content: "\00A0";
}

.font-size-small .pinyin-raw .char .text {
    font-size: 16px !important;
}

.font-size-normal .pinyin-raw .char .text {
    font-size: 22px !important;
}

.font-size-normal .pinyin-raw .char {
    margin-right: 0px;
}

.font-size-large .pinyin-raw .char .text {
    font-size: 36px !important;
}

.pinyin-raw .char.wrong {
    background: #ff9eaf !important;
    color: #000 !important;
    border-radius: 5px !important;
    box-shadow: 0 0 4px rgba(244, 67, 54, 0.35);
    animation: wrong-shake 120ms ease-out forwards;
}

.pinyin-raw .char.correct {
    background: #c7ffb8 !important;
    color: #000 !important;
    border-radius: 5px !important;
    animation: correct-flash 120ms ease-out forwards;
}

.pinyin-raw .char.once-wronged.typed.correct {
    background: #fff4d4 !important;
    color: #000 !important;
    border-radius: 5px !important;
}

@media (prefers-reduced-motion: reduce) {

    .pinyin-raw .char.wrong,
    .pinyin-raw .char.correct {
        animation: none;
    }
}
