.mol-shell {
    --mol-ink: #252044;
    --mol-muted: #5d5675;
    --mol-violet: #6743c8;
    --mol-line: #e5dcf8;
    --mol-paper: #fff;
    --mol-panel: #f8f5ff;
    --mol-mint: #e4f9ef;
    --mol-green: #176344;
    --mol-peach: #fff0e7;
    --mol-rust: #844116;
    max-width: 62rem;
    margin-inline: auto;
}

.mol-shell [hidden] { display: none !important; }
.mol-shell h2 { font-size: 1.26rem; font-weight: 800; letter-spacing: -.02em; }
.mol-shell h3 { font-size: 1.05rem; font-weight: 750; }
.mol-shell :focus-visible { outline: 3px solid #367fed; outline-offset: 3px; }

.mol-hero {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 1rem;
    overflow: hidden;
    padding: clamp(1rem, 4vw, 2.35rem);
    border: 1px solid #d8c9fb;
    border-radius: 1.5rem;
    background: linear-gradient(120deg, #f2eaff 4%, #e8e7ff 55%, #c6f6ea);
    color: #252044;
}

.mol-hero::after {
    content: '';
    position: absolute;
    z-index: -1;
    inset: 0;
    background: radial-gradient(#9476cb 1px, transparent 1px) right top / 14px 14px;
    mask-image: linear-gradient(90deg, transparent 41%, #0007);
}

.mol-kicker {
    margin: 0 0 .4rem;
    font-size: .78rem;
    letter-spacing: .045em;
    font-weight: 750;
    color: #543b89;
}

.mol-hero h1 {
    margin: 0 0 .45rem;
    font-size: clamp(1.9rem, 5.1vw, 3.35rem);
    letter-spacing: -.055em;
    line-height: 1.03;
    font-weight: 850;
}

.mol-hero p:last-child { max-width: 41rem; margin: 0; line-height: 1.43; }

.mol-emblem {
    position: relative;
    display: grid;
    place-items: center;
    inline-size: clamp(3.3rem, 16vw, 8.25rem);
    aspect-ratio: 1;
    margin: .15rem .3rem .5rem 0;
    transform: rotate(9deg);
    border: 2px solid #fff;
    border-radius: 28%;
    background: linear-gradient(145deg, #a681ff, #6d48cd);
    box-shadow: 0 .36rem 0 #51319b, 0 .75rem 1.7rem #623abe48;
    color: #fff;
    font-size: clamp(2.15rem, 8vw, 4.6rem);
    font-weight: 850;
    line-height: 1;
}

.mol-emblem i { position: absolute; font-size: .31em; color: #ffda73; text-shadow: 0 1px 0 #845717; }
.mol-emblem i:first-of-type { right: -.35em; top: .3em; }
.mol-emblem i:last-of-type { bottom: .1em; left: -.45em; transform: scale(.7); }

.mol-stage {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    margin-block: 1rem 2rem;
    padding: clamp(.65rem, 2.5vw, 1.35rem);
    border: 1px solid var(--mol-line);
    border-radius: 1.4rem;
    background: var(--mol-panel);
    color: var(--mol-ink);
    scroll-margin-top: 1rem;
}

.mol-controls, .mol-stats, .mol-actions, .mol-onward {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
}

.mol-controls { justify-content: space-between; margin-bottom: .75rem; }
.mol-stats { gap: .35rem; }
.mol-stats > span {
    padding: .35rem .62rem;
    border: 1px solid var(--mol-line);
    border-radius: 999px;
    background: var(--mol-paper);
    font-size: .84rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.mol-stats .fa-star { color: #b17308; }
.mol-stats .fa-bolt { color: #936016; }
#mol-heart, .mol-milestone .fa { color: #b32d6f; }

.mol-panel {
    min-width: 0;
    padding: clamp(.8rem, 3vw, 1.6rem);
    border: 1px solid var(--mol-line);
    border-radius: 1.1rem;
    background: var(--mol-paper);
}

.mol-start { display: grid; grid-template-columns: 1.4fr 1fr; align-items: center; gap: 1rem 1.5rem; }
.mol-start label { display: block; font-weight: 700; margin-bottom: .15rem; }
.mol-start select { color: var(--mol-ink); background-color: var(--mol-paper); border-color: var(--mol-line); }
.mol-start .mol-muted { margin-top: .25rem; }
.mol-muted { color: var(--mol-muted); }

.mol-button, .mol-toggle {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: .45rem;
    width: fit-content;
    min-height: 2.75rem;
    padding: .49rem .85rem;
    border: 1px solid transparent;
    border-radius: .75rem;
    font-weight: 750;
    line-height: 1.25;
    text-align: center;
}

.mol-button {
    background: #6642c4;
    color: #fff;
    box-shadow: 0 3px 0 #44288e;
}
.mol-button:hover:not(:disabled) { background: #5430b1; }
.mol-button:active:not(:disabled) { box-shadow: 0 1px 0 #44288e; translate: 0 2px; }
.mol-button:disabled { background: #e1d9ef; color: #5d5476; box-shadow: none; }
.mol-toggle { border-color: var(--mol-line); background: var(--mol-paper); color: var(--mol-ink); }
.mol-toggle:hover:not(:disabled), .mol-toggle[aria-pressed="true"] { border-color: var(--mol-violet); color: var(--mol-violet); }
.mol-toggle:disabled { opacity: .75; }

.mol-round {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .45rem .7rem;
    font-size: .87rem;
}
.mol-round progress { flex: 1 0 25%; min-width: 3rem; height: .8rem; accent-color: var(--mol-violet); }
.mol-milestone {
    width: fit-content;
    margin: .55rem 0 .75rem;
    padding: .3rem .6rem;
    border-radius: .5rem;
    background: var(--mol-mint);
    color: var(--mol-green);
    font-size: .85rem;
    font-weight: 690;
}
.mol-tier { margin-bottom: .65rem; color: var(--mol-muted); }

.mol-clues { list-style: none; display: grid; gap: .5rem; margin: 0 0 1rem; padding: 0; }
.mol-clue {
    display: flex;
    align-items: start;
    gap: .65rem;
    padding: .62rem .74rem;
    border: 1px solid var(--mol-line);
    border-radius: .8rem;
    background: var(--mol-panel);
    animation: mol-enter .23s ease-out both;
}
.mol-clue p { margin: 0; }
.mol-rung {
    flex: 0 0 1.65rem;
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    border-radius: .5rem;
    background: #6a45cb;
    color: #fff;
    font-weight: 800;
}
.mol-clue-kind { display: block; font-size: .76rem; color: var(--mol-muted); margin: 0 0 .12rem; }
.mol-picture { display: block; inline-size: min(100%, 7.5rem); block-size: auto; aspect-ratio: 1; border-radius: .7rem; }
.mol-clue .mol-picture { margin-top: .4rem; }

.mol-choose { margin: 0 0 .55rem; }
.mol-choices { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: .7rem; }
.mol-choice {
    flex: 1 0 6.4rem;
    display: grid;
    place-items: center;
    align-content: center;
    min-width: 0;
    min-height: 3.35rem;
    padding: .45rem .32rem;
    border: 1px solid var(--mol-line);
    border-radius: .7rem;
    background: var(--mol-paper);
    color: var(--mol-ink);
    line-height: 1.2;
}
.mol-choice:hover:not(:disabled), .mol-choice[aria-pressed="true"] { border-color: var(--mol-violet); background: var(--mol-panel); }
.mol-choice[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--mol-violet); }
.mol-choice[data-missed="true"] { color: var(--mol-muted); text-decoration: line-through; }
.mol-hanzi { font-size: 1.25rem; font-weight: 750; overflow-wrap: anywhere; }
.mol-pinyin { font-size: .79rem; color: var(--mol-muted); }

.mol-reveal {
    display: grid;
    grid-template-columns: 1fr minmax(3.75rem, 7.5rem);
    align-items: center;
    gap: .7rem;
    margin-bottom: .85rem;
    padding: .78rem;
    border-radius: .8rem;
    background: var(--mol-mint);
    color: var(--mol-green);
    animation: mol-enter .24s ease-out both;
}
.mol-reveal[data-correct="false"] { background: var(--mol-peach); color: var(--mol-rust); }
.mol-reveal:has(> div:only-child) { grid-template-columns: 1fr; }
.mol-reveal p { margin: .24rem 0 0; }
.mol-reveal a { color: inherit; }
.mol-points { font-weight: 850; }
.mol-neighbor { font-size: .86rem; }
.mol-neighbor .mol-hanzi { font-size: 1rem; }

.mol-feedback { margin: .55rem 0 0; font-weight: 700; font-size: .89rem; }
.mol-feedback:empty { margin: 0; }
.mol-feedback[data-kind="correct"] { color: var(--mol-green); }
.mol-feedback[data-kind="try"], .mol-error { color: var(--mol-rust); }
.mol-error { margin: .45rem 0 0; }
.mol-results > p { margin: .35rem 0; }
.mol-actions { margin: .85rem 0; }
.mol-onward { gap: .45rem 1rem; margin-top: 1rem; }
.mol-misses { list-style: none; display: grid; gap: .4rem; margin: 0 0 .5rem; padding: 0; }
.mol-misses li { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem .75rem; }
.mol-leaderboard, .mol-guide { margin-block: 1.5rem; }
.mol-guide { max-width: 48rem; }

.mol-effects {
    position: absolute;
    inset: 0;
    z-index: 2;
    overflow: hidden;
    pointer-events: none;
}
.mol-particle, .mol-float { position: absolute; left: var(--x); top: var(--y); }
.mol-particle {
    inline-size: .45rem;
    block-size: .65rem;
    border-radius: .15rem;
    background: var(--color);
    animation: mol-burst .75s var(--delay) ease-out both;
}
.mol-particle-finish { border-radius: 50%; inline-size: .58rem; block-size: .58rem; }
.mol-particle-heart { inline-size: .62rem; block-size: .35rem; }
.mol-float {
    padding: .25rem .5rem;
    border-radius: .5rem;
    background: #faffdc;
    color: #225735;
    font-weight: 850;
    animation: mol-float .82s ease-out both;
}

@keyframes mol-enter { from { opacity: .5; transform: translateY(4px); } }
@keyframes mol-burst {
    0% { opacity: 0; transform: scale(.35); }
    12% { opacity: 1; }
    82% { opacity: .9; }
    100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(175deg) scale(.6); }
}
@keyframes mol-float {
    0% { opacity: 0; transform: translate(-50%, 0) scale(.8); }
    15%, 70% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -2.65rem) scale(1.1); }
}

@media (max-width: 575px) {
    .mol-hero { gap: .4rem; }
    .mol-start { grid-template-columns: 1fr; gap: .65rem; }
}

[data-bs-theme="dark"] .mol-shell {
    --mol-ink: #f4edff;
    --mol-muted: #d3c6ee;
    --mol-violet: #d2b8ff;
    --mol-line: #5e5178;
    --mol-paper: #28213a;
    --mol-panel: #322649;
    --mol-mint: #163d32;
    --mol-green: #a8f5cf;
    --mol-peach: #513025;
    --mol-rust: #ffd9be;
}
[data-bs-theme="dark"] .mol-stats .fa { color: #ffd678; }
[data-bs-theme="dark"] #mol-heart, [data-bs-theme="dark"] .mol-milestone .fa { color: #ffaad8; }

@media (prefers-reduced-motion: reduce) {
    .mol-stage *, .mol-stage *::before, .mol-stage *::after { animation: none !important; translate: none !important; }
    .mol-effects { display: none; }
}
