.hanzi-pop-open {
    overflow: hidden;
}

.hanzi-pop__backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(15, 23, 42, 0.32);
}

.hanzi-pop {
    display: none;
    position: fixed;
    left: 50%;
    top: 42%;
    transform: translate(-50%, -50%);
    z-index: 55;
    width: min(20rem, calc(100vw - 2rem));
    padding: 1rem 1rem 0.85rem;
    border-radius: 0.75rem;
    background: #fff;
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.24);
}

.hanzi-pop__head {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.25rem 0.4rem;
    margin-bottom: 0.35rem;
}

.hanzi-pop__char {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.1;
}

.hanzi-pop__speak {
    appearance: none;
    border: 0;
    background: transparent;
    color: #2563eb;
    padding: 0.1rem;
    line-height: 0;
    border-radius: 0.35rem;
    cursor: pointer;
}

.hanzi-pop__meta {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #64748b;
    line-height: 1.3;
}

@media (hover: hover) and (pointer: fine) {
    .hanzi-pop__speak:hover {
        color: #1d4ed8;
        background: #eff6ff;
    }
}

.hanzi-pop__canvas-wrap {
    position: relative;
    width: 11rem;
    height: 11rem;
    margin: 0 auto;
}

.hanzi-pop__loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    font-size: 0.875rem;
    color: #64748b;
    pointer-events: none;
    z-index: 1;
}

.hanzi-pop__canvas {
    width: 100%;
    height: 100%;
    border: 2px solid #e2e8f0;
    border-radius: 0.5rem;
    background: #fafafa;
    box-sizing: border-box;
}

.hanzi-pop__canvas svg {
    display: block;
    margin: 0 auto;
}

.hanzi-pop__error {
    margin: 0.55rem 0 0;
    text-align: center;
    font-size: 0.8125rem;
    color: #b91c1c;
}

.hanzi-pop__result {
    margin: 0.55rem 0 0;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: #15803d;
}

.hanzi-pop__buttons {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.85rem;
}

.hanzi-pop__buttons-row {
    display: flex;
    gap: 0.4rem;
}

.hanzi-pop__buttons-row .hanzi-pop__btn {
    flex: 1 1 0;
    min-width: 0;
}

.hanzi-pop__btn--wide {
    width: 100%;
}

.hanzi-pop__btn {
    appearance: none;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #334155;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.2;
    padding: 0.38rem 0.65rem;
    border-radius: 0.4rem;
    cursor: pointer;
}

.hanzi-pop__btn.is-active {
    border-color: #dc2626;
    background: #ef4444;
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

@media (hover: hover) and (pointer: fine) {
    .hanzi-pop__btn:hover {
        border-color: #94a3b8;
    }

    .hanzi-pop__btn.is-active:hover {
        background: #dc2626;
        border-color: #b91c1c;
    }
}

.hanzi-char-btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 600;
    padding: 0 0.05rem;
    margin: 0;
    line-height: inherit;
    border-radius: 0.25rem;
    cursor: pointer;
    text-decoration: underline dotted transparent;
    transition: color 0.12s ease, background 0.12s ease, text-decoration-color 0.12s ease;
}

@media (hover: hover) and (pointer: fine) {
    .hanzi-char-btn:hover {
        color: #dc2626;
        background: #fef2f2;
        text-decoration-color: #fca5a5;
    }
}

.hanzi-char-btn:active {
    color: #b91c1c;
}
