.cangjie-type span {
    display: block;
    font-family: "ROBOTO";
}

.cangjie-type-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cangjie-type-row.cangjie-type-xword {
    display: flex;
    flex-direction: column;
}

.cangjie-type {
    letter-spacing: 2px;
    text-align: center;
    padding: 6px 0px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-weight: bold;
}

.cangjie-type-philosophy .cangjie-type {
    background: #a75caa;
    color: #FFF;
}
.cangjie-type-philosophy .cangjie-type-group-title {
    background: #fcd5f6;
}
.cangjie-type-philosophy .cangjie-type-group-item {
    background: #ffeafc;
}

.cangjie-type-stroke .cangjie-type {
    background: #e37256;
    color: #FFF;
}
.cangjie-type-stroke .cangjie-type-group-title {
    background: #fbe0bc;
}
.cangjie-type-stroke .cangjie-type-group-item {
    background: #ffecd3;
}

.cangjie-type-human .cangjie-type {
    background: #9bc749;
    color: #FFF;
}
.cangjie-type-human .cangjie-type-group-title {
    background: #e0ef6e;
}
.cangjie-type-human .cangjie-type-group-item {
    background: #f4f2ba;
}

.cangjie-type-word .cangjie-type {
    background: #4db0db;
    color: #FFF;
}
.cangjie-type-word .cangjie-type-group-title {
    background: #b9f0f8;
}
.cangjie-type-word .cangjie-type-group-item {
    background: #e0fbff;
}

.cangjie-type-xword .cangjie-type {
    background: #837973;
    color: #FFF;
}
.cangjie-type-xword .cangjie-type-group-title {
    background: #d1cbc7;
}
.cangjie-type-xword .cangjie-type-group-item {
    background: #e8e5e2;
}

.cangjie-type-item-group {
    display: flex;
    flex-direction: row;
    border-radius: 6px;
    overflow: hidden;
}

.cangjie-type-group-item {
    flex: 1;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    padding: 4px 4px 4px 8px;
}

.cangjie-type-item {
    width: 13px;
    height: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.15s;
}

.cangjie-type-group-title {
    width: 48px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

/* ── Wrapper ─────────────────────────────────── */
#cangjie-chart-overlay {
    width: 100%;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 8px;
    border-radius: 10px;
    font-family: "ROBOTO";
}

#cangjie-chart-body img {
    width: 16px;
    height: 16px;
}

/* ── Fade transition ─────────────────────────── */
.cangjie-chart-fade-enter        { transition: opacity 0.22s ease; }
.cangjie-chart-fade-enter-start  { opacity: 0; }
.cangjie-chart-fade-enter-end    { opacity: 1; }
.cangjie-chart-fade-leave        { transition: opacity 0.18s ease; }
.cangjie-chart-fade-leave-start  { opacity: 1; }
.cangjie-chart-fade-leave-end    { opacity: 0; }

/* ── Panel ───────────────────────────────────── */
#cangjie-chart-panel {
    background: #FFF;
    border: 1px solid rgba(255,255,255,0.10);
    width: 100%;
    max-height: 55vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Slide-down transition ───────────────────── */
.cangjie-chart-slide-enter        { transition: transform 0.26s cubic-bezier(.22,.68,0,1.1), opacity 0.22s ease; }
.cangjie-chart-slide-enter-start  { transform: translateY(-12px); opacity: 0; }
.cangjie-chart-slide-enter-end    { transform: translateY(0);     opacity: 1; }
.cangjie-chart-slide-leave        { transition: transform 0.18s ease, opacity 0.18s ease; }
.cangjie-chart-slide-leave-start  { transform: translateY(0);     opacity: 1; }
.cangjie-chart-slide-leave-end    { transform: translateY(-10px); opacity: 0; }

/* ── Header ──────────────────────────────────── */
#cangjie-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

#cangjie-chart-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #e0e0e0;
    letter-spacing: 0.06em;
}

#cangjie-chart-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.45);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}

#cangjie-chart-close:hover {
    color: #fff;
    background: rgba(255,255,255,0.10);
}

/* ── Body ────────────────────────────────────── */
#cangjie-chart-body {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    padding: 14px 18px;
    overflow-y: auto;
    flex: 1;
}

/* ── Sections ────────────────────────────────── */
.cangjie-chart-section {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cangjie-chart-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255,255,255,0.30);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ── SVG wrapper ─────────────────────────────── */
.cangjie-chart-svg-wrapper {
    width: 100%;
    overflow: visible;
}

.cangjie-chart-svg-wrapper svg {
    width: 100%;
    height: auto;
    display: block;
}

/* ── SVG placeholder ─────────────────────────── */
.cangjie-chart-svg-placeholder {
    background: rgba(255,255,255,0.04);
    border: 1px dashed rgba(255,255,255,0.12);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    color: rgba(255,255,255,0.28);
    font-size: 0.78rem;
    line-height: 1.6;
}

/* ── Scrollbar ───────────────────────────────── */
#cangjie-chart-body::-webkit-scrollbar       { width: 4px; }
#cangjie-chart-body::-webkit-scrollbar-track  { background: transparent; }
#cangjie-chart-body::-webkit-scrollbar-thumb  { background: rgba(255,255,255,0.12); border-radius: 4px; }

/* ── Responsive ──────────────────────────────── */
@media (max-width: 640px) {
    #cangjie-chart-body {
        display: flex;
        flex-direction: column;
    }
}
