@import url('https://fonts.googleapis.com/css2?family=M+PLUS+1p:wght@400;500;700;800&family=Noto+Sans+TC:wght@400;500;700;800&display=swap');

:root {
    --ink-900: #1c1f26;
    --ink-700: #383f4a;
    --paper: #fffdf7;
    --paper-soft: #fff7ea;
    --momo-yellow: #f4b942;
    --momo-yellow-deep: #d98a1f;
    --momo-blue: #3f8fd1;
    --momo-blue-deep: #1c5d94;
    --momo-ink: #1c1f26;
    --momo-charcoal: #34383f;
    --line-soft: rgba(28, 31, 38, 0.14);
    --profile-panel-bg: rgba(255, 255, 255, 0.8);
    --profile-panel-shadow: 0 10px 24px rgba(57, 71, 88, 0.1);
    --profile-heading-bg: linear-gradient(110deg, #fffdf7, #eef7ff);
    --profile-row-bg: rgba(255, 255, 255, 0.58);
    --profile-row-hover-bg: #ffffff;
    --profile-preview-bg: #fffaf0;
    --profile-unavailable-bg: #f4f5f6;
}

html, body {
    font-family: 'M PLUS 1p', 'Noto Sans TC', sans-serif;
    background:
        radial-gradient(circle at 10% 0%, rgba(255, 230, 196, 0.68) 0%, rgba(255, 230, 196, 0) 40%),
        radial-gradient(circle at 90% 10%, rgba(186, 225, 255, 0.58) 0%, rgba(186, 225, 255, 0) 38%),
        linear-gradient(180deg, #fffefb 0%, #fff9f0 65%, #fff4e8 100%);
    color: var(--ink-900);
    min-height: 100%;
}

h1:focus {
    outline: none;
}

/* ── Game Layout ── */
.home-container,
.quiz-card {
    max-width: 480px;
    margin: 1rem auto;
}

/* ── Player Card ── */
.player-card {
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
}

.player-card .text-muted { color: #aaa !important; }
.player-card .progress   { background-color: #333; }

.hp-full  { opacity: 1;   font-size: 1.1rem; }
.hp-empty { opacity: 0.2; font-size: 1.1rem; }

/* ── Mode Buttons ── */
.mode-btn {
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    background: #fff;
}

.mode-btn:hover  { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.12) !important; }
.mode-btn:active { transform: translateY(0); }
.mode-locked     { background: #f0f0f0; cursor: not-allowed; }

.mode-icon {
    font-size: 2rem;
    min-width: 2.5rem;
    text-align: center;
}

/* ── HP Exhausted Dialog ── */
.hp-dialog-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 999;
}

.hp-dialog {
    max-width: 320px;
    width: 90%;
    border-radius: 16px;
}

/* ── Quiz Card ── */
.quiz-card   { border-radius: 12px; border: none; }
.prompt-box  { padding: 1rem; background: #f0f4ff; border-radius: 8px; }

.grammar-prompt-box {
    border: 1px solid rgba(63, 143, 209, 0.22);
}

.grammar-prompt-line {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    flex-wrap: wrap;
}

.grammar-prompt-box h5 {
    margin: 0;
    line-height: 1.45;
}

.grammar-pronunciation-controls {
    display: inline-flex;
    align-items: center;
    gap: 0;
}

.grammar-pronunciation-btn {
    display: inline-flex;
    width: 30px;
    height: 30px;
    min-height: 30px;
    flex: 0 0 30px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.grammar-pronunciation-btn > span {
    display: inline-flex;
    line-height: 1;
    transform: translateY(-1px);
}

.grammar-pronunciation-btn-slow > span {
    transform: translateY(-4px);
}

.grammar-pronunciation-btn:hover {
    transform: translateY(-1px);
}

.grammar-pronunciation-btn:focus-visible {
    outline: 2px solid #258cfb;
    outline-offset: 2px;
}

.grammar-pronunciation-btn-normal {
    background: transparent;
    color: #24587f;
}

.grammar-pronunciation-btn-normal:hover {
    background: rgba(220, 238, 255, 0.72);
    box-shadow: none;
}

.grammar-pronunciation-btn-slow {
    background: transparent;
    color: #805a17;
}

.grammar-pronunciation-btn-slow:hover {
    background: rgba(255, 237, 185, 0.72);
    box-shadow: none;
}

.grammar-quiz-card {
    background:
        radial-gradient(circle at 85% 8%, rgba(255, 219, 166, 0.42) 0%, transparent 36%),
        radial-gradient(circle at 12% 0%, rgba(182, 223, 255, 0.35) 0%, transparent 34%),
        linear-gradient(170deg, #fffefb 0%, #fff8ee 100%);
    border: 1.5px solid rgba(222, 194, 147, 0.5);
    box-shadow: 0 12px 26px rgba(88, 65, 25, 0.12);
}

.grammar-quiz-header {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.grammar-topic-heading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    padding: 0.9rem 1rem 1rem;
    border: 1px solid rgba(217, 138, 31, 0.28);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(255, 251, 235, 0.92), rgba(238, 247, 255, 0.95));
    text-align: start;
}

.grammar-topic-heading .character-reaction {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
}

.grammar-topic-heading h1 {
    min-width: 0;
    margin: 0;
    color: var(--ink-900);
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.grammar-quiz-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
}

.grammar-quiz-stat {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid rgba(95, 111, 128, 0.2);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.72);
}

.grammar-hp-stat {
    border-color: rgba(208, 91, 91, 0.28);
    background: rgba(255, 245, 245, 0.82);
}

.grammar-progress-stat {
    border-color: rgba(63, 143, 209, 0.28);
    background: rgba(240, 247, 255, 0.86);
}

.grammar-premium-stat {
    border-color: rgba(217, 138, 31, 0.3);
    background: rgba(255, 250, 231, 0.9);
}

.grammar-stat-icon {
    display: inline-flex;
    width: 2rem;
    height: 2rem;
    flex: 0 0 2rem;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.82);
    font-size: 1rem;
}

.grammar-stat-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 0.08rem;
}

.grammar-stat-label {
    overflow: hidden;
    color: #6c7784;
    font-size: 0.66rem;
    font-weight: 700;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.grammar-stat-value {
    overflow: hidden;
    color: var(--ink-900);
    font-size: 0.98rem;
    font-weight: 800;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.grammar-stat-value small {
    color: #7c8792;
    font-size: 0.72rem;
    font-weight: 700;
}

.grammar-character-strip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.45rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(194, 167, 118, 0.35);
}


.grammar-answer-zone {
    min-height: 84px;
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(252,247,238,0.98));
    border-color: rgba(176, 147, 102, 0.4) !important;
}

.grammar-token-pool {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    justify-content: stretch !important;
}

.grammar-token-option,
.grammar-token-selected {
    min-height: 48px;
    border-radius: 11px;
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.2;
}

.grammar-token-option {
    width: 100%;
    white-space: normal;
    word-break: keep-all;
    overflow-wrap: anywhere;
}

.grammar-token-option {
    border: 2px solid #d3dce8;
    background: #ffffff;
    color: #2f3e50;
}

.grammar-token-option:hover:not(:disabled) {
    border-color: #5e8fbf;
    background: #f4f9ff;
    transform: translateY(-1px);
}

.grammar-token-option.is-selected,
.grammar-token-option:disabled {
    border-color: #c2c9d1;
    background: #e7eaee;
    color: #89929d;
    box-shadow: none;
    cursor: not-allowed;
}

.grammar-token-selected {
    border: 2px solid #2b6fa8;
    background: linear-gradient(135deg, #3d86c4, #2a6598);
    color: #fff;
}

.grammar-token-option:disabled,
.grammar-token-selected:disabled {
    opacity: 0.82;
}

.token-pool  { gap: 4px; }

.btn-tts {
    background: none;
    border: 1px solid #ccc;
    border-radius: 50%;
    width: 32px; height: 32px;
    padding: 0; line-height: 1;
    cursor: pointer;
    vertical-align: middle;
}

.btn-tts:hover { background: #e8f0fe; }

a, .btn-link {
    color: #0071c1;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ════════════════════════════════════════
   Food Hunt Mode (WordQuiz /quiz/word/… route)
   ════════════════════════════════════════ */

.dungeon-page {
    max-width: 480px;
    margin: 0 auto;
    padding: 0.5rem 1rem 3rem;
}

/* ── Entry / Start Screen ── */
.dungeon-entry {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    text-align: center;
}

.dungeon-banner {
    background: linear-gradient(160deg, #1b4332 0%, #2d6a4f 100%);
    border-radius: 20px;
    padding: 1.5rem 2rem 1.25rem;
    width: 100%;
    color: #fff;
    box-shadow: 0 8px 32px rgba(0,0,0,.25);
}
.dungeon-gate-emoji {
    font-size: 3.2rem;
    display: block;
    margin-bottom: 0.5rem;
    animation: gate-float 2.4s ease-in-out infinite;
}
@keyframes gate-float {
    0%, 100% { transform: translateY(0) rotate(-3deg); }
    50%       { transform: translateY(-8px) rotate(3deg); }
}
.dungeon-title-text {
    font-size: 1.5rem;
    font-weight: bold;
    color: #a8e6cf;
    letter-spacing: .04em;
    margin-bottom: 0.4rem;
}
.dungeon-level-badge {
    display: inline-block;
    border: 1.5px solid #a8e6cf;
    color: #a8e6cf;
    border-radius: 8px;
    padding: 1px 12px;
    font-size: 0.78rem;
    font-weight: bold;
    opacity: .85;
}

.dungeon-stats-row {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}
.dungeon-stat {
    background: #f8f4ee;
    border-radius: 12px;
    padding: 0.5rem 0.4rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: #5d4037;
    flex: 1;
    text-align: center;
}

.dungeon-enter-btn {
    width: 100%;
    background: linear-gradient(135deg, #e8b86d, #c8922e);
    border: none;
    border-radius: 14px;
    padding: 0.9rem;
    font-size: 1.05rem;
    font-weight: bold;
    color: #1a1a2e;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(232,184,109,.4);
    transition: transform .15s, box-shadow .15s;
}
.dungeon-enter-btn:hover  { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(232,184,109,.55); }
.dungeon-enter-btn:active { transform: translateY(0); }

.dungeon-back-link {
    background: none; border: none;
    color: #9e9e9e; font-size: 0.85rem; cursor: pointer; padding: 0;
}
.dungeon-back-link:hover { color: #616161; }

.dungeon-return-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    background: #ffffff;
    color: #2d3436;
    border: 2px solid #2d3436;
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    margin: 0;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.dungeon-return-btn:hover {
    background: #f5f7fa;
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.16);
}

.dungeon-return-btn:active {
    transform: translateY(0);
}

/* ── Quiz Session ── */
.dungeon-session {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.dungeon-dots {
    display: flex;
    justify-content: center;
    gap: 5px;
    padding: 0.3rem 0;
}
.dungeon-dot {
    width: 26px; height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: bold;
    transition: background .25s;
}
.dot-todo    { background: #ecf0f1; color: #b2bec3; }
.dot-current { background: #fdcb6e; color: #2d3436; animation: dot-pulse 1.2s ease-in-out infinite; }
@keyframes dot-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(253,203,110,.5); } 50% { box-shadow: 0 0 0 5px rgba(253,203,110,0); } }
.dot-ok { background: #00b894; color: white; }
.dot-x  { background: #e17055; color: white; }

.dungeon-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.dungeon-hp { font-size: 0.8rem; font-weight: bold; color: #e17055; white-space: nowrap; }
.dungeon-combo {
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: bold;
}
.combo-normal { background: #ecf0f1; color: #7f8c8d; }
.combo-hot    { background: #fdcb6e; color: #2d3436; }
.combo-fever  { background: #e17055; color: white; animation: fever-pulse .6s infinite alternate; }
@keyframes fever-pulse { to { opacity: .65; } }
.dungeon-exp    { font-weight: bold; color: #00b894; font-size: 0.88rem; }
.dungeon-timer  { font-size: 0.9rem; font-weight: bold; min-width: 34px; text-align: right; }
.timer-urgent   { color: #e17055; animation: timer-blink .5s infinite alternate; }
@keyframes timer-blink { to { opacity: .35; } }

.dungeon-timer-track {
    height: 5px; background: #ecf0f1; border-radius: 3px; overflow: hidden;
}
.dungeon-timer-fill {
    height: 100%; border-radius: 3px; transition: width 1s linear, background .4s;
}
.timer-fill-expired { transition: none; }
.timer-fill-ok  { background: #00b894; }
.timer-fill-hot { background: #fdcb6e; }
.timer-fill-low { background: #e17055; }

.dungeon-word-card {
    background: linear-gradient(160deg, #1b4332, #2d6a4f);
    border-radius: 18px;
    padding: 1.4rem 1rem;
    text-align: center;
    color: white;
    box-shadow: 0 6px 24px rgba(0,0,0,.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}
.dungeon-word-kanji   { font-size: 2.6rem; font-weight: bold; line-height: 1; display: flex; align-items: flex-end; gap: 0.45rem; }
.dungeon-word-reading { color: #a8e6cf; font-size: 0.9rem; display: flex; align-items: center; gap: 6px; }
.dungeon-speak-btn {
    background: rgba(255,255,255,.15); border: none; border-radius: 50%;
    width: 26px; height: 26px; cursor: pointer; color: white; font-size: 0.75rem;
    transition: background .15s;
}
.dungeon-speak-btn:hover { background: rgba(255,255,255,.3); }
.dungeon-word-category {
    font-size: 0.68rem; color: #95a5a6;
    background: rgba(255,255,255,.08); border-radius: 6px; padding: 1px 8px;
}

.dungeon-choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
}
.dungeon-choice {
    background: white;
    border: 2px solid #dfe6e9;
    border-radius: 12px;
    padding: 0.9rem 0.7rem;
    font-size: 1rem;
    font-weight: 600;
    color: #2d3436;
    cursor: pointer;
    transition: border-color .12s, background .12s, transform .1s;
    line-height: 1.35;
    min-height: 66px;
}
.dungeon-choice:hover:not(:disabled) { border-color: #e8b86d; background: #fffbf2; transform: translateY(-1px); }
.dungeon-choice:disabled { cursor: default; }
.dc-correct { background: #d1fae5 !important; border-color: #00b894 !important; color: #065f46 !important; }
.dc-wrong   { background: #fee2e2 !important; border-color: #e17055 !important; color: #991b1b !important; }
.dc-neutral { opacity: .4; }

.dungeon-feedback {
    text-align: center; font-size: 0.95rem; font-weight: bold;
    padding: 0.5rem; border-radius: 10px;
    animation: fb-pop .2s ease-out;
}
@keyframes fb-pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.fb-ok { background: #d1fae5; color: #065f46; }
.fb-x  { background: #fee2e2; color: #991b1b; }

/* ── Result Screen ── */
.dungeon-result {
    display: flex; flex-direction: column; align-items: center;
    gap: 1rem; padding: 1rem 0 2rem; text-align: center;
}
.result-stars {
    display: flex; justify-content: center;
    align-items: flex-end; gap: 6px;
    font-size: 2.4rem; line-height: 1;
}
.result-star { color: #dfe6e9; transition: all .3s; }
.result-star.star-on {
    color: #f39c12;
    filter: drop-shadow(0 0 8px rgba(243,156,18,.55));
    animation: star-in .4s cubic-bezier(.36,1.6,.5,1) both;
}
.result-stars .result-star:nth-child(2) { font-size: 3rem; }
.result-star.star-on:nth-child(1) { animation-delay: .1s; }
.result-star.star-on:nth-child(2) { animation-delay: .3s; }
.result-star.star-on:nth-child(3) { animation-delay: .5s; }
@keyframes star-in { from { transform: scale(0) rotate(-25deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }

.result-title    { font-size: 1.4rem; font-weight: bold; color: #2d3436; }
.result-subtitle { font-size: 0.82rem; color: #95a5a6; }

.dungeon-score-card {
    background: #f8f9fa; border-radius: 16px;
    padding: 1.1rem 1.4rem; width: 100%;
    display: flex; flex-direction: column; gap: 0.55rem;
}
.score-row { display: flex; justify-content: space-between; font-size: 0.88rem; color: #636e72; }
.score-val { font-weight: bold; color: #2d3436; }
.score-exp { font-weight: bold; color: #00b894; }

.result-dots {
    display: flex; justify-content: center; gap: 4px; flex-wrap: wrap; margin-top: 0.2rem;
}
.rd {
    width: 25px; height: 25px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; font-weight: bold;
}
.rd-ok { background: #00b894; color: white; }
.rd-x  { background: #e17055; color: white; }

.dungeon-retry-btn {
    width: 100%; background: linear-gradient(135deg, #e8b86d, #c8922e);
    border: none; border-radius: 14px; padding: 0.8rem;
    font-size: 1rem; font-weight: bold; color: #1a1a2e; cursor: pointer;
    transition: transform .15s;
}
.dungeon-retry-btn:hover { transform: translateY(-2px); }
.dungeon-exit-btn {
    background: none; border: 1.5px solid #dfe6e9; border-radius: 12px;
    padding: 0.65rem; width: 100%; font-size: 0.88rem; color: #636e72; cursor: pointer;
    transition: background .15s;
}
.dungeon-exit-btn:hover { background: #f8f9fa; }

.world-map {
    max-width: 480px;
    margin: 0 auto;
    padding: 0.75rem 1rem 3rem;
}

/* Player header row */
.wm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
    gap: 0.5rem;
}
.wm-lv-info { font-size: 0.95rem; }

.premium-member-badge {
    position: relative;
    isolation: isolate;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 8.8rem;
    padding: 0.35rem 0.65rem 0.35rem 0.4rem;
    overflow: hidden;
    border: 1px solid rgba(218, 170, 63, 0.78);
    border-radius: 999px;
    background: linear-gradient(135deg, #34383f 0%, #181b20 56%, #4a3b1f 100%);
    color: #ffe9a6;
    box-shadow: 0 5px 14px rgba(57, 43, 18, 0.2), inset 0 1px 0 rgba(255, 244, 193, 0.22);
}

.premium-member-badge::after {
    position: absolute;
    inset: 0;
    z-index: 0;
    content: "";
    background: linear-gradient(110deg, transparent 20%, rgba(255, 255, 255, 0.18) 48%, transparent 70%);
    pointer-events: none;
    transform: translateX(-125%);
    animation: premium-sheen 6s ease-in-out infinite;
}

.premium-member-mark {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.55rem;
    height: 1.55rem;
    flex: 0 0 1.55rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #fff2ac, #d49a32);
    color: #25282d;
    font-size: 0.95rem;
    box-shadow: 0 0 0 2px rgba(255, 222, 131, 0.14), 0 2px 7px rgba(0, 0, 0, 0.25);
}

.premium-member-copy {
    position: relative;
    z-index: 1;
    display: flex;
    min-width: 0;
    flex-direction: column;
    line-height: 1.05;
}

.premium-member-copy strong {
    color: #fff4c7;
    font-size: 0.68rem;
    font-weight: 800;
}

.premium-member-copy small {
    margin-top: 0.16rem;
    overflow: hidden;
    color: #d9bb75;
    font-size: 0.6rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@keyframes premium-sheen {
    0%, 55% { transform: translateX(-125%); }
    75%, 100% { transform: translateX(125%); }
}

/* Streak badge */
.wm-streak {
    font-size: 0.85rem;
    font-weight: 600;
    color: #b2bec3;
    white-space: nowrap;
}
.streak-active { color: #e17055; }

/* Daily missions bar */
.wm-daily-bar {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.6rem;
    flex-wrap: wrap;
}
.daily-item {
    font-size: 0.72rem;
    background: #f0f0f0;
    border-radius: 20px;
    padding: 3px 10px;
    color: #636e72;
    font-weight: 600;
}
.daily-done { background: #d1fae5; color: #065f46; }
.daily-hint { margin-left: auto; color: #b2bec3; background: none; font-weight: 400; }

/* HP exhausted banner */
.hp-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #fff5f5;
    border: 1.5px solid #feb2b2;
    border-radius: 12px;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #c53030;
    flex-wrap: wrap;
}
.hp-banner-btn {
    background: #fff;
    border: 1.5px solid #feb2b2;
    border-radius: 8px;
    padding: 3px 10px;
    font-size: 0.78rem;
    cursor: pointer;
    color: #c53030;
    transition: background .15s;
}
.hp-banner-btn:hover { background: #fed7d7; }
.hp-banner-premium { border-color: #f6e05e; color: #744210; }
.hp-banner-premium:hover { background: #fefcbf; }

/* EXP bar */
.wm-exp-section { margin-bottom: 0.75rem; }
.exp-track {
    height: 8px;
    background: #dfe6e9;
    border-radius: 4px;
    overflow: hidden;
}
.exp-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--momo-yellow), var(--momo-blue));
    border-radius: 4px;
    transition: width 0.4s ease;
}

/* Level cards */
.wm-path { display: flex; flex-direction: column; gap: 0; }

.wm-level-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border-radius: 18px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    position: relative;
    color: white;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.wm-level-card:hover:not(.wm-locked) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,.2) !important;
}
.wm-level-card:active:not(.wm-locked) { transform: translateY(0); }

.wm-locked  { filter: grayscale(70%); opacity: 0.55; cursor: not-allowed; }

/* Season colour themes */
.wm-n5 { background: linear-gradient(135deg, #ffd27a 0%, #f2a53c 100%); }
.wm-n4 { background: linear-gradient(135deg, #6bb6e8 0%, #2f7cc2 100%); }
.wm-n3 { background: linear-gradient(135deg, #4a4f58 0%, #22252b 100%); }
.wm-n2 { background: linear-gradient(135deg, #2f5f95 0%, #16324f 100%); }
.wm-n1 { background: linear-gradient(135deg, #111318 0%, #2c2f36 100%); }

/* Active (current level) glow */
.wm-active {
    box-shadow: 0 0 0 3px #fff, 0 0 0 6px rgba(255,200,0,.65),
                0 8px 24px rgba(0,0,0,.18) !important;
}

.wm-card-emoji { font-size: 2.4rem; flex-shrink: 0; }

.wm-card-body { flex: 1; min-width: 0; }

.wm-level-badge {
    background: rgba(255,255,255,.28);
    border-radius: 6px;
    padding: 1px 8px;
    font-size: 0.72rem;
    font-weight: bold;
    flex-shrink: 0;
}
.wm-season    { font-size: 0.72rem; opacity: .85; }
.wm-card-desc { opacity: .82; }
.wm-card-body .text-muted { color: rgba(255,255,255,.7) !important; }

.wm-progress-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.wm-mini-bar {
    flex: 1;
    height: 5px;
    background: rgba(255,255,255,.3);
    border-radius: 3px;
    overflow: hidden;
}
.wm-mini-fill {
    height: 100%;
    background: rgba(255,255,255,.9);
    border-radius: 3px;
    transition: width .4s ease;
}
.wm-prog-label {
    font-size: 0.68rem;
    white-space: nowrap;
    opacity: .9;
}

/* CTA button inside card */
.wm-card-cta {
    background: rgba(255,255,255,.22);
    border-radius: 10px;
    padding: 0.35rem 0.8rem;
    font-size: 0.82rem;
    font-weight: bold;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background .2s;
}
.cta-pulse {
    background: white;
    color: #2d3436;
    animation: cta-bounce 1.8s ease-in-out infinite;
}
@keyframes cta-bounce {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.07); }
}
.cta-done { background: rgba(0,220,100,.25); }
.cta-lock { background: rgba(0,0,0,.18); }

/* ── Word Dungeon List page (/quiz/word) ── */
.wdl-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: #2d3436;
    margin-bottom: 0.9rem;
    text-align: center;
    letter-spacing: .02em;
}
.wdl-level-section {
    margin-bottom: 0.75rem;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,.1);
}
.wdl-level-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1rem;
    color: white;
}
.wdl-level-emoji  { font-size: 1.5rem; }
.wdl-level-name   { font-size: 1rem; font-weight: bold; }
.wdl-level-region { font-size: 0.75rem; opacity: .85; margin-left: auto; }
.wdl-chips {
    background: #fffbf0;
    padding: 0.55rem 0.75rem 0.65rem;
    flex-wrap: wrap;
    overflow-x: unset;
}
.wdl-loading {
    background: #f8f9fa;
    padding: 0.5rem 1rem;
    font-size: 0.78rem;
    color: #b2bec3;
}

/* Vocabulary dungeon grid (used in Map page) */
.vocab-section {
    margin: 1rem 1rem 1.5rem;
    background: rgba(255, 248, 230, 0.85);
    border: 1.5px solid #fdcb6e;
    border-radius: 16px;
    padding: 0.85rem 0.9rem 1rem;
}
.vocab-section-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #7c5a00;
    margin-bottom: 0.65rem;
}
.vocab-section-count {
    margin-left: auto;
    font-size: 0.75rem;
    font-weight: 500;
    color: #b08030;
    background: rgba(253, 203, 110, 0.35);
    border-radius: 10px;
    padding: 1px 8px;
}
.vocab-theme-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.vocab-theme-card {
    border: 1px solid rgba(253, 203, 110, 0.75);
    border-radius: 14px;
    background: linear-gradient(165deg, rgba(255, 252, 240, 0.96), rgba(255, 243, 214, 0.86));
    overflow: hidden;
}

.vocab-theme-header {
    width: 100%;
    border: none;
    background: transparent;
    color: #5e4208;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
        "title toggle"
        "meta toggle";
    column-gap: 10px;
    row-gap: 3px;
    text-align: left;
    padding: 0.7rem 0.85rem;
    cursor: pointer;
}

.vocab-theme-header:hover {
    background: rgba(255, 237, 180, 0.22);
}

.vocab-theme-title {
    grid-area: title;
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.25;
}

.vocab-theme-meta {
    grid-area: meta;
    font-size: 0.74rem;
    font-weight: 600;
    color: #9a6a14;
}

.vocab-theme-toggle {
    grid-area: toggle;
    align-self: center;
    justify-self: end;
    padding: 2px 9px;
    border-radius: 999px;
    border: 1px solid rgba(188, 138, 45, 0.45);
    font-size: 0.72rem;
    font-weight: 700;
    color: #7c5208;
    background: rgba(255, 238, 194, 0.7);
}

.vocab-theme-preview,
.vocab-dungeon-grid {
    padding: 0 0.75rem 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.vocab-preview-more {
    align-self: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: #9f6c14;
    background: rgba(255, 231, 173, 0.8);
    border-radius: 999px;
    padding: 4px 9px;
}

.dungeon-chip {
    background: linear-gradient(135deg, #ffedd1, #ffe2af);
    border: 1.5px solid #f2c14e;
    border-radius: 999px;
    padding: 5px 11px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #2f2e2b;
    cursor: pointer;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    transition: transform .12s, box-shadow .12s;
}

.dungeon-chip .chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
}

.dungeon-chip .chip-count {
    font-size: 0.66rem;
    font-weight: 700;
    color: #8b5a13;
    background: rgba(255, 247, 224, 0.88);
    border-radius: 999px;
    padding: 2px 6px;
}

.dungeon-chip.is-preview {
    white-space: nowrap;
}

.dungeon-chip:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(242, 193, 78, 0.42);
}

.dungeon-chip:active {
    transform: translateY(0);
}

.dungeon-chip.chip-locked {
    opacity: 0.72;
    filter: grayscale(0.18);
}

@media (min-width: 560px) {
    .vocab-theme-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .vocab-theme-card.is-expanded {
        grid-column: span 2;
    }
}

/* Connector between level cards */
.wm-connector {
    display: flex;
    justify-content: center;
    padding: 4px 0;
}
.conn-unlocked {
    width: 3px; height: 22px;
    background: #b2bec3;
    border-radius: 2px;
}
.conn-locked {
    width: 3px; height: 22px;
    border-radius: 2px;
    background: repeating-linear-gradient(
        to bottom,
        #b2bec3 0, #b2bec3 4px,
        transparent 4px, transparent 8px
    );
}

/* Hero banner on MapHome */
.wm-hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 1.1rem 1.2rem 1.2rem;
    margin-bottom: 0.6rem;
    border-radius: 16px;
    background: linear-gradient(130deg, #fdf7f0 0%, #edf2fc 100%);
    border-left: 4px solid var(--momo-yellow-deep);
    box-shadow: 0 2px 14px rgba(0,0,0,0.06);
    overflow: hidden;
}
.wm-hero-copy {
    position: relative;
    z-index: 1;
    min-width: 0;
}
.wm-hero-title {
    margin: 0;
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--ink-900);
}
.wm-hero-subtitle {
    margin: 0.3rem 0 0;
    color: var(--ink-700);
    font-size: 0.88rem;
}
.wm-hero-logo {
    flex: 0 0 clamp(80px, 18vw, 130px);
    width: clamp(80px, 18vw, 130px);
    height: clamp(58px, 11vw, 84px);
    align-self: stretch;
    background-image: url('../images/characters/teacher_joy.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.92;
}
.wm-hero-logo-premium {
    background-image: url('../images/characters/teacher_happy.png');
}

@media (max-width: 576px) {
    .wm-hero {
        gap: 0.5rem;
    }

    .wm-hero-logo {
        flex-basis: 72px;
        width: 72px;
        height: 52px;
    }
}

@media (max-width: 420px) {
    .wm-header {
        flex-wrap: wrap;
    }

    .premium-member-badge {
        flex: 1 0 100%;
        justify-content: center;
        order: 3;
    }
}

/* Hint banner shared by MapHome and Map */
.wm-hint-banner,
.map-hint-banner {
    margin: 0.45rem 0 0.7rem;
    padding: 0.55rem 0.7rem;
    border-radius: 11px;
    font-size: 0.83rem;
    font-weight: 600;
    color: #7a3417;
    background: #fff2e1;
    border: 1px solid #ffddb9;
    width: 100%;
    box-sizing: border-box;
}

/* Grammar quiz completion screen */
.completion-star {
    font-size: 4rem;
    animation: star-pop .5s cubic-bezier(.36,1.6,.5,1) both;
}
@keyframes star-pop {
    0%   { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
.completion-exp-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--momo-blue) 0%, var(--momo-blue-deep) 100%);
    color: white;
    border-radius: 20px;
    padding: 0.3rem 1.2rem;
    font-size: 1.1rem;
    font-weight: 800;
    margin-top: 0.5rem;
}

/* ════════════════════════════════════════
   Map Page — MoMo Trail (Unified)
   ════════════════════════════════════════ */

/* Level-specific header gradients */
.map-n5 { background: linear-gradient(135deg, #ffd27a 0%, #f2a53c 100%); }
.map-n4 { background: linear-gradient(135deg, #6bb6e8 0%, #2f7cc2 100%); }
.map-n3 { background: linear-gradient(135deg, #4a4f58 0%, #22252b 100%); }
.map-n2 { background: linear-gradient(135deg, #2f5f95 0%, #16324f 100%); }
.map-n1 { background: linear-gradient(135deg, #111318 0%, #2c2f36 100%); border-bottom: 1px solid rgba(244, 185, 66, 0.4); }

/* Page wrapper */
.map-page {
    max-width: 640px;
    margin: 0 auto 2rem;
    min-height: calc(100vh - 1rem);
    border-radius: 28px;
    border: 1px solid var(--line-soft);
    background:
        radial-gradient(circle at 15% 8%, rgba(254, 222, 176, 0.45) 0%, transparent 36%),
        radial-gradient(circle at 85% 12%, rgba(170, 214, 248, 0.40) 0%, transparent 34%),
        linear-gradient(180deg, #fffcf7 0%, #fff4e6 100%);
    box-shadow: 0 24px 48px rgba(43, 48, 61, 0.15);
    overflow: visible;
}

/* Sticky header */
.map-header {
    padding: 1rem 1rem 1.25rem;
    color: white;
    border-radius: 28px 28px 0 0;
    position: sticky;
    top: 0;
    z-index: 2;
    box-shadow: 0 6px 20px rgba(35, 38, 48, 0.18);
}

.map-back-btn {
    background: rgba(255,255,255,.22);
    border: none;
    color: inherit;
    border-radius: 8px;
    padding: 4px 12px;
    font-size: 0.82rem;
    cursor: pointer;
    margin-bottom: 0.4rem;
    transition: background .2s;
}
.map-back-btn:hover { background: rgba(255,255,255,.38); }

.map-title {
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.map-hp-row { margin-top: 0.4rem; }
.hp-full  { opacity: 1;   font-size: 1.1rem; }
.hp-empty { opacity: 0.2; font-size: 1.1rem; }

/* ── Chapter Trail ── */
.chapter-trail {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 1.5rem 0.75rem 3rem;
}

/* ── Chapter Card (replaces icon-only circle nodes) ── */
.chapter-card {
    border-radius: 18px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(0,0,0,.10);
    border: 1.5px solid transparent;
    transition: box-shadow .15s;
}
.chapter-card-cleared {
    background: linear-gradient(160deg, #f0f7ff, #e2effd);
    border-color: rgba(63, 143, 209, 0.35);
}
.chapter-card-current {
    background: linear-gradient(160deg, #fffbe8, #fff3c4);
    border-color: rgba(244, 185, 66, 0.55);
    box-shadow: 0 8px 22px rgba(217, 138, 31, .18), 0 0 0 3px rgba(244,185,66,.18);
    animation: card-pulse 2.4s ease-in-out infinite;
}
@keyframes card-pulse {
    0%, 100% { box-shadow: 0 8px 22px rgba(217,138,31,.18), 0 0 0 3px rgba(244,185,66,.18); }
    50%       { box-shadow: 0 8px 22px rgba(217,138,31,.10), 0 0 0 8px rgba(244,185,66,.08); }
}

/* ── Per-character card themes (current state) ── */

/* MOMO: 白黑 — crisp white, soft black rim */
.chapter-card-current.card-char-momo {
    background: linear-gradient(160deg, #fafafa, #eeeeee);
    border-color: rgba(30, 30, 30, 0.28);
    box-shadow: 0 8px 22px rgba(0,0,0,.13), 0 0 0 3px rgba(0,0,0,.08);
    animation: card-pulse-momo 2.4s ease-in-out infinite;
}
@keyframes card-pulse-momo {
    0%, 100% { box-shadow: 0 8px 22px rgba(0,0,0,.13), 0 0 0 3px rgba(0,0,0,.08); }
    50%       { box-shadow: 0 8px 22px rgba(0,0,0,.05), 0 0 0 9px rgba(0,0,0,.04); }
}
.chapter-card-current.card-char-momo .chapter-num-badge { background: #1c1c1c; color: #fff; }

/* ICHI: 白粉 — soft pink white, hot-pink accent */
.chapter-card-current.card-char-ichi {
    background: linear-gradient(160deg, #fff0f8, #fce7f3);
    border-color: rgba(236, 72, 153, 0.48);
    box-shadow: 0 8px 22px rgba(219,39,119,.18), 0 0 0 3px rgba(236,72,153,.22);
    animation: card-pulse-ichi 2.4s ease-in-out infinite;
}
@keyframes card-pulse-ichi {
    0%, 100% { box-shadow: 0 8px 22px rgba(219,39,119,.18), 0 0 0 3px rgba(236,72,153,.22); }
    50%       { box-shadow: 0 8px 22px rgba(219,39,119,.08), 0 0 0 9px rgba(236,72,153,.09); }
}
.chapter-card-current.card-char-ichi .chapter-num-badge  { background: #ec4899; color: #fff; }
.chapter-card-current.card-char-ichi .chapter-card-title  { color: #831843; }
.chapter-card-current.card-char-ichi .chapter-card-focus  { color: #be185d; }
.chapter-card-current.card-char-ichi .inline-grammar-btn  { background: rgba(255,255,255,.70); border-color: rgba(244,114,182,.35); color: #831843; }
.chapter-card-current.card-char-ichi .igb-current         { border-color: rgba(244,114,182,.60); background: rgba(255,240,249,.98); }

/* KEN: 白紅 — pure white, vivid red accent */
.chapter-card-current.card-char-ken {
    background: linear-gradient(160deg, #fff8f8, #ffe8e8);
    border-color: rgba(153, 27, 27, 0.38);
    box-shadow: 0 8px 22px rgba(140,20,20,.18), 0 0 0 3px rgba(153,27,27,.18);
    animation: card-pulse-ken 2.4s ease-in-out infinite;
}
@keyframes card-pulse-ken {
    0%, 100% { box-shadow: 0 8px 22px rgba(140,20,20,.18), 0 0 0 3px rgba(153,27,27,.18); }
    50%       { box-shadow: 0 8px 22px rgba(140,20,20,.07), 0 0 0 9px rgba(153,27,27,.07); }
}
.chapter-card-current.card-char-ken .chapter-num-badge { background: #b91c1c; color: #fff; }

/* LION: 黃白 — warm golden cream */
.chapter-card-current.card-char-lion {
    background: linear-gradient(160deg, #fffde7, #fff8b0);
    border-color: rgba(234, 179, 8, 0.58);
    box-shadow: 0 8px 22px rgba(180, 130, 0, .20), 0 0 0 3px rgba(234,179,8,.22);
    animation: card-pulse-lion 2.4s ease-in-out infinite;
}
@keyframes card-pulse-lion {
    0%, 100% { box-shadow: 0 8px 22px rgba(180,130,0,.20), 0 0 0 3px rgba(234,179,8,.22); }
    50%       { box-shadow: 0 8px 22px rgba(180,130,0,.08), 0 0 0 9px rgba(234,179,8,.08); }
}
.chapter-card-current.card-char-lion .chapter-num-badge { background: #ca8a04; color: #fff; }

/* TEACHER: 藍白 — soft sky blue, clean white */
.chapter-card-current.card-char-teacher {
    background: linear-gradient(160deg, #eff6ff, #dbeafe);
    border-color: rgba(59, 130, 246, 0.42);
    box-shadow: 0 8px 22px rgba(37, 99, 235, .16), 0 0 0 3px rgba(59,130,246,.18);
    animation: card-pulse-teacher 2.4s ease-in-out infinite;
}
@keyframes card-pulse-teacher {
    0%, 100% { box-shadow: 0 8px 22px rgba(37,99,235,.16), 0 0 0 3px rgba(59,130,246,.18); }
    50%       { box-shadow: 0 8px 22px rgba(37,99,235,.07), 0 0 0 9px rgba(59,130,246,.08); }
}
.chapter-card-current.card-char-teacher .chapter-num-badge { background: #1d4ed8; color: #fff; }

/* ── Per-character CLEARED card themes ── */
.chapter-card-cleared.card-char-momo {
    background: linear-gradient(160deg, #f9f9f9, #efefef);
    border-color: rgba(50, 50, 50, 0.22);
}
.chapter-card-cleared.card-char-ichi {
    background: linear-gradient(160deg, #fff0f8, #fce4f1);
    border-color: rgba(219, 39, 119, 0.28);
}
.chapter-card-cleared.card-char-ken {
    background: linear-gradient(160deg, #fff6f6, #fde8e8);
    border-color: rgba(153, 27, 27, 0.26);
}
.chapter-card-cleared.card-char-lion {
    background: linear-gradient(160deg, #fffde8, #fef6bf);
    border-color: rgba(202, 138, 4, 0.32);
}
.chapter-card-cleared.card-char-teacher {
    background: linear-gradient(160deg, #eff6ff, #dbeafe);
    border-color: rgba(59, 130, 246, 0.30);
}

.chapter-card-locked {
    background: linear-gradient(160deg, #f6f8fa, #edf0f3);
    border-color: rgba(160, 172, 184, 0.38);
    opacity: 0.72;
}

.chapter-card-header {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.8rem 0.9rem 0.7rem;
}
.chapter-num-badge {
    min-width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--momo-blue-deep);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(28,93,148,.25);
}
.chapter-card-cleared .chapter-num-badge { background: var(--momo-blue); }
.chapter-card-current .chapter-num-badge { background: var(--momo-yellow-deep); color: #1a1a2e; }
.chapter-card-locked  .chapter-num-badge { background: #9aa5b1; }
/* per-character cleared badge overrides */
.chapter-card-cleared.card-char-momo    .chapter-num-badge { background: #555;    color: #fff; }
.chapter-card-cleared.card-char-ichi    .chapter-num-badge { background: #db2777; color: #fff; }
.chapter-card-cleared.card-char-ken     .chapter-num-badge { background: #b91c1c; color: #fff; }
.chapter-card-cleared.card-char-lion    .chapter-num-badge { background: #ca8a04; color: #fff; }
.chapter-card-cleared.card-char-teacher .chapter-num-badge { background: #2563eb; color: #fff; }

.chapter-card-info { flex: 1; min-width: 0; }
.chapter-card-title {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--ink-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chapter-card-focus {
    font-size: 0.72rem;
    color: #5a6778;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chapter-mascot-img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 50%;
    padding: 3px;
}

/* Per-character colour rings on chapter mascots */
.mascot-momo    { background: linear-gradient(135deg, #f5f5f5, #1c1c1c); }
.mascot-ichi    { background: linear-gradient(135deg, #12121e, #ec4899); }
.mascot-ken     { background: linear-gradient(135deg, #fecaca, #991b1b); }
.mascot-lion    { background: linear-gradient(135deg, #fbbf24, #fffde7); }
.mascot-teacher { background: linear-gradient(135deg, #1d4ed8, #bfdbfe); }

/* ── Inline Grammar List ── */
.chapter-grammar-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 0 0.75rem 0.75rem;
}
.inline-grammar-btn {
    display: flex;
    align-items: center;
    gap: 9px;
    background: rgba(255,255,255,0.82);
    border: 1.5px solid #dde3e9;
    border-radius: 11px;
    padding: 8px 10px;
    font-size: 0.84rem;
    font-weight: 600;
    font-family: inherit;
    text-align: start;
    cursor: pointer;
    color: var(--ink-900);
    transition: background .12s, border-color .12s, transform .12s;
    width: 100%;
}
.inline-grammar-btn:not(:disabled):hover {
    background: #eef4ff;
    border-color: var(--momo-blue);
    transform: translateX(2px);
}
.inline-grammar-btn:disabled { cursor: not-allowed; opacity: .52; }

.igb-cleared { border-color: rgba(34,197,94,.40);  background: rgba(240,253,244,.92); border-left: 4px solid #22c55e; }
.igb-current { border-color: rgba(244,185,66,.55);  background: rgba(255,251,235,.97); border-left: 4px solid #f59e0b; }
.igb-locked  { border-color: rgba(180,188,198,.4);  background: rgba(246,248,250,.85); }

/* Per-character grammar button colors — cleared state (green left border = "done") */
.card-char-momo    .igb-cleared { border-left: 4px solid #22c55e; border-color: rgba(34,197,94,.28);   background: rgba(240,253,244,.96); }
.card-char-ichi    .igb-cleared { border-left: 4px solid #22c55e; border-color: rgba(34,197,94,.28);   background: rgba(255,240,249,.94); }
.card-char-ken     .igb-cleared { border-left: 4px solid #22c55e; border-color: rgba(34,197,94,.28);   background: rgba(240,253,244,.96); }
.card-char-lion    .igb-cleared { border-left: 4px solid #22c55e; border-color: rgba(34,197,94,.35);   background: rgba(240,253,244,.96); }
.card-char-teacher .igb-cleared { border-left: 4px solid #22c55e; border-color: rgba(34,197,94,.32);   background: rgba(240,253,244,.96); }
/* Per-character grammar button colors — current (unlocked) state */
.card-char-momo    .igb-current { border-left: 4px solid #1c1c1c; border-color: rgba(30,30,30,.35);    background: rgba(255,255,255,.99); }
.card-char-ichi    .igb-current { border-left: 4px solid #db2777; border-color: rgba(219,39,119,.40);  background: rgba(255,240,249,.98); }
.card-char-ken     .igb-current { border-left: 4px solid #b91c1c; border-color: rgba(185,28,28,.45);   background: rgba(255,248,248,.99); }
.card-char-lion    .igb-current { border-left: 4px solid #ca8a04; border-color: rgba(202,138,4,.55);   background: rgba(255,253,215,.99); }
.card-char-teacher .igb-current { border-left: 4px solid #2563eb; border-color: rgba(37,99,235,.45);   background: rgba(239,246,255,.99); }
/* Ichi active-card (dark bg) overrides the light rule above */
.chapter-card-current.card-char-ichi .igb-current { border-left: 4px solid #ec4899; border-color: rgba(244,114,182,.60); background: rgba(255,240,249,.98); color: #831843; }
.chapter-card-current.card-char-ichi .igb-cleared { border-left: 4px solid #22c55e; border-color: rgba(34,197,94,.35);   background: rgba(236,253,245,.95); color: #166534; }





.igb-mascot {
    width: 34px;
    height: 34px;
    object-fit: contain;
    border-radius: 50%;
    flex-shrink: 0;
    padding: 2px;
}

/* Mascot bg also on grammar button icons */
.igb-char-momo    .igb-mascot { background: linear-gradient(135deg, #f5f5f5, #1c1c1c); }
.igb-char-ichi    .igb-mascot { background: linear-gradient(135deg, #12121e, #ec4899); }
.igb-char-ken     .igb-mascot { background: linear-gradient(135deg, #fecaca, #991b1b); }
.igb-char-lion    .igb-mascot { background: linear-gradient(135deg, #fbbf24, #fffde7); }
.igb-char-teacher .igb-mascot { background: linear-gradient(135deg, #1d4ed8, #bfdbfe); }
.igb-label { flex: 1; }
.igb-badge {
    min-width: 24px;
    height: 24px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.igb-badge-done  { background: var(--momo-blue); color: #fff; }
.igb-badge-go    { background: var(--momo-yellow); color: #1a1a2e; }
.igb-badge-lock  { background: #e2e6eb; font-size: 0.8rem; }
.igb-badge-stars { background: transparent; color: #f59e0b; font-size: 0.75rem; letter-spacing: -1px; min-width: 36px; }

/* ── Per-chapter Dungeon Chips ── */
.chapter-dungeon-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 0.75rem 0.85rem;
    border-top: 1px solid rgba(0,0,0,.06);
    padding-top: 0.6rem;
}
.dungeon-inline-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #fff6de, #ffe9a8);
    border: 1.5px solid rgba(165,110,24,.28);
    border-radius: 10px;
    padding: 6px 10px;
    font-size: 0.78rem;
    font-weight: 700;
    font-family: inherit;
    color: #3a2800;
    cursor: pointer;
    transition: transform .12s;
    box-shadow: 0 2px 6px rgba(140,103,31,.12);
}
.dungeon-inline-chip:not(.dic-locked):hover { transform: translateY(-1px); }
.dic-locked {
    background: linear-gradient(135deg, #f0f3f6, #dde3e9);
    border-color: rgba(160,172,184,.3);
    color: #7a8694;
    cursor: not-allowed;
}
.dic-cleared {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    border-color: rgba(22,163,74,.30);
    color: #14532d;
    box-shadow: 0 2px 6px rgba(22,163,74,.14);
}
.dic-cleared .dic-stars { color: #16a34a; }
.dic-icon { font-size: 0.95rem; }
.dic-label { font-weight: 700; }
.dic-stars { font-size: 0.7rem; color: #7d6030; margin-left: 2px; }
.dic-locked .dic-stars { color: #9aa5b1; }

/* Per-character dungeon chip themes */
.card-char-momo .dungeon-inline-chip:not(.dic-locked):not(.dic-cleared) {
    background: linear-gradient(135deg, #f7f7f7, #d8d8d8);
    border-color: rgba(58,58,58,.28);
    color: #1c1c1c;
    box-shadow: 0 2px 6px rgba(0,0,0,.12);
}
.card-char-momo .dungeon-inline-chip:not(.dic-locked):not(.dic-cleared) .dic-stars { color: #444; }
.card-char-ichi .dungeon-inline-chip:not(.dic-locked):not(.dic-cleared) {
    background: linear-gradient(135deg, #fff8e6, #fdecc8);
    border-color: rgba(180, 138, 62, .34);
    color: #7c5322;
    box-shadow: 0 2px 6px rgba(180,138,62,.12);
}
.card-char-ichi .dungeon-inline-chip:not(.dic-locked):not(.dic-cleared) .dic-stars { color: #a16207; }
.card-char-lion .dungeon-inline-chip:not(.dic-locked):not(.dic-cleared) {
    background: linear-gradient(135deg, #fff3c2, #ffd978);
    border-color: rgba(202,138,4,.34);
    color: #8a4b00;
    box-shadow: 0 2px 6px rgba(180,130,0,.14);
}
.card-char-lion .dungeon-inline-chip:not(.dic-locked):not(.dic-cleared) .dic-stars { color: #b45309; }
.card-char-ken .dungeon-inline-chip:not(.dic-locked):not(.dic-cleared) {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    border-color: rgba(153,27,27,.28);
    color: #7f1d1d;
    box-shadow: 0 2px 6px rgba(153,27,27,.12);
}
.card-char-ken .dungeon-inline-chip:not(.dic-locked):not(.dic-cleared) .dic-stars { color: #b91c1c; }
.card-char-teacher .dungeon-inline-chip:not(.dic-locked):not(.dic-cleared) {
    background: linear-gradient(135deg, #fffaf2, #ffe6d5);
    border-color: rgba(240, 124, 82, .30);
    color: #7c2d12;
    box-shadow: 0 2px 6px rgba(240,124,82,.12);
}
.card-char-teacher .dungeon-inline-chip:not(.dic-locked):not(.dic-cleared) .dic-stars { color: #ea580c; }

/* ── Locked chapter hint ── */
.chapter-locked-hint {
    font-size: 0.8rem;
    color: #8a94a3;
    padding: 0.5rem 0.9rem 0.75rem;
    font-style: italic;
}

/* Faint left spine */
.chapter-trail::before {
    content: "";
    position: absolute;
    top: 1rem;
    bottom: 2.5rem;
    left: 1.7rem;
    width: 4px;
    border-radius: 999px;
    transform: none;
    background: linear-gradient(180deg, rgba(169, 180, 196, 0.35) 0%, rgba(137, 150, 166, 0.10) 100%);
    z-index: 0;
}

/* Vertical connector between chapter cards */
.trail-connector {
    position: relative;
    z-index: 1;
    width: 4px;
    height: 20px;
    border-radius: 999px;
    background: linear-gradient(180deg, #c8d3dc, #b8c6d0);
    flex-shrink: 0;
    align-self: flex-start;
    margin-left: 1.45rem;
}
.trail-connector.cleared-conn {
    background: linear-gradient(180deg, var(--momo-blue), var(--momo-blue-deep));
    box-shadow: 0 0 8px rgba(63, 143, 209, 0.3);
}

/* Node row with zigzag */
.trail-node-row {
    position: relative;
    z-index: 1;
    width: 100%;
    display: flex;
}
.offset-left  { justify-content: flex-start; padding-left: 6%; }
.offset-right { justify-content: flex-end;   padding-right: 6%; }

/* Chapter node button — icon-only circle (Duolingo style) */
.chapter-node-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
}
.chapter-node-btn:disabled { cursor: not-allowed; }

/* Node circle wrapper with badge */
.node-circle-wrap {
    position: relative;
}

.node-circle {
    width: 86px;
    height: 86px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    border: 5px solid transparent;
    transition: transform .15s;
}
.chapter-node-btn:not(:disabled):hover .node-circle { transform: scale(1.08); }

/* Cleared: deep blue + checkmark */
.node-cleared {
    background: linear-gradient(145deg, var(--momo-blue) 0%, var(--momo-blue-deep) 100%);
    border-color: #7bbde5;
    color: white;
    box-shadow:
        0 0 0 4px rgba(63, 143, 209, 0.18),
        0 8px 22px rgba(28, 93, 148, 0.35);
}

/* Current: warm yellow + pulsing glow ring */
.node-current {
    background: linear-gradient(145deg, #fffbe8 0%, #ffd966 100%);
    border-color: var(--momo-yellow);
    color: #7a3c00;
    animation: node-pulse 2s ease-in-out infinite;
    box-shadow:
        0 0 0 6px rgba(244, 185, 66, 0.28),
        0 8px 22px rgba(217, 138, 31, 0.30);
}
@keyframes node-pulse {
    0%, 100% { box-shadow: 0 0 0 6px rgba(244,185,66,.28), 0 8px 22px rgba(217,138,31,.30); }
    50%       { box-shadow: 0 0 0 15px rgba(244,185,66,.10), 0 8px 22px rgba(217,138,31,.22); }
}

/* Locked: muted gray */
.node-locked {
    background: linear-gradient(145deg, #f0f3f6, #dde3e9);
    border-color: #c2ccd7;
    color: #a0acb8;
    box-shadow: 0 4px 10px rgba(74, 83, 94, 0.12);
}

/* Chapter index number badge */
.node-index-badge {
    position: absolute;
    bottom: -6px;
    right: -8px;
    min-width: 26px;
    height: 26px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--momo-blue-deep);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,.22);
}

/* ── Dungeon Branch Nodes (side branches off chapter nodes) ── */
.dungeon-branch {
    position: relative;
    z-index: 1;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.1rem 0;
}
.branch-left  { justify-content: flex-start; padding-left: 8%; }
.branch-right { justify-content: flex-end;   padding-right: 8%; }

.dungeon-line {
    width: 32px;
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, #f2c14e, #ee9f42);
    flex-shrink: 0;
}

.dungeon-node {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform .15s;
}
.dungeon-node:not(.dungeon-btn-locked):hover { transform: translateY(-2px) scale(1.06); }

.dungeon-node-star {
    position: absolute;
    bottom: -5px;
    right: -7px;
    min-width: 22px;
    height: 22px;
    padding: 0 3px;
    border-radius: 999px;
    background: var(--momo-yellow-deep);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2.5px solid #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,.18);
}

.dungeon-node.dungeon-btn-unpassed {
    background: linear-gradient(145deg, #ffe9b8, #f7ca60);
    border-color: rgba(165, 110, 24, 0.3);
    box-shadow: 0 6px 14px rgba(120, 80, 10, 0.18);
}
.dungeon-node.dungeon-btn-tried {
    background: linear-gradient(145deg, #ffe5cc, #ffb87a);
    border-color: rgba(175, 98, 38, 0.35);
    box-shadow: 0 6px 14px rgba(140, 70, 20, 0.18);
}
.dungeon-node.dungeon-btn-passed {
    background: linear-gradient(145deg, var(--momo-blue), var(--momo-blue-deep));
    border-color: rgba(31, 95, 149, 0.4);
    box-shadow: 0 6px 14px rgba(28, 93, 148, 0.28);
}
/* Per-character dungeon node — passed/cleared state */
.card-char-momo    .dungeon-btn-passed { background: linear-gradient(145deg, #555, #222);     border-color: rgba(0,0,0,.35);       box-shadow: 0 6px 14px rgba(0,0,0,.22); }
.card-char-ichi    .dungeon-btn-passed { background: linear-gradient(145deg, #ec4899, #9d174d); border-color: rgba(157,23,77,.42);   box-shadow: 0 6px 14px rgba(157,23,77,.28); }
.card-char-ken     .dungeon-btn-passed { background: linear-gradient(145deg, #ef4444, #991b1b); border-color: rgba(153,27,27,.42);   box-shadow: 0 6px 14px rgba(153,27,27,.28); }
.card-char-lion    .dungeon-btn-passed { background: linear-gradient(145deg, #f59e0b, #b45309); border-color: rgba(180,83,9,.40);    box-shadow: 0 6px 14px rgba(180,83,9,.24); }
.card-char-teacher .dungeon-btn-passed { background: linear-gradient(145deg, #3b82f6, #1d4ed8); border-color: rgba(29,78,216,.42);   box-shadow: 0 6px 14px rgba(29,78,216,.26); }
.dungeon-node.dungeon-btn-locked {
    background: linear-gradient(145deg, #f0f3f6, #dde3e9);
    border-color: rgba(97, 107, 118, 0.28);
    color: #a0acb8;
    cursor: not-allowed;
    box-shadow: 0 3px 8px rgba(74, 83, 94, 0.1);
}

.dungeon-branch + .dungeon-branch { margin-top: 0.3rem; }

/* Boss/completion node at end of trail */
.boss-complete {
    position: relative;
    z-index: 1;
    text-align: center;
    margin-top: 0.5rem;
}
.boss-star {
    width: 86px;
    height: 86px;
    border-radius: 50%;
    background: linear-gradient(145deg, #ffd700, #ff8c00);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    margin: 0 auto;
    box-shadow:
        0 0 0 8px rgba(255, 200, 0, 0.18),
        0 0 28px rgba(255, 200, 0, 0.5);
    animation: cta-bounce 2s ease-in-out infinite;
}

/* ── Vocabulary Dungeon Grid Section ── */
.vocab-section {
    margin: 1rem 1rem 1.5rem;
    padding: 1rem;
    background: linear-gradient(165deg, rgba(255, 251, 241, 0.95), rgba(255, 240, 206, 0.88));
    border: 1px solid rgba(227, 169, 67, 0.44);
    border-radius: 18px;
    box-shadow: 0 12px 22px rgba(78, 64, 31, 0.10);
}

.vocab-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: #7d500e;
    margin-bottom: 0.8rem;
}
.vocab-section-count {
    font-size: 0.78rem;
    font-weight: 600;
    color: #9b6720;
}

.vocab-theme-grid {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.vocab-theme-card {
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(196, 137, 35, 0.32);
    border-radius: 13px;
    overflow: hidden;
    box-shadow: 0 5px 12px rgba(88, 64, 24, 0.08);
}

.vocab-theme-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    background: none;
    border: none;
    padding: 0.72rem 0.88rem;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: background .12s;
}
.vocab-theme-header:hover { background: rgba(255, 248, 230, 0.7); }

.vocab-theme-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #4a3210;
    flex: 1;
}
.vocab-theme-meta {
    font-size: 0.72rem;
    color: #9b6720;
}
.vocab-theme-toggle {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--momo-blue-deep);
    margin-left: 0.4rem;
    white-space: nowrap;
}

.vocab-theme-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 0.88rem 0.75rem;
}
.vocab-preview-more {
    font-size: 0.72rem;
    color: #9b6720;
    display: flex;
    align-items: center;
}

.vocab-dungeon-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0 0.88rem 0.75rem;
}

.dungeon-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #fff6de, #ffe9a8);
    border: 1px solid rgba(165, 110, 24, 0.28);
    border-radius: 10px;
    padding: 0.52rem 0.8rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #3a2800;
    cursor: pointer;
    transition: transform .12s;
    box-shadow: 0 3px 8px rgba(140, 103, 31, 0.12);
    font-family: inherit;
}
.dungeon-chip:not(.chip-locked):hover { transform: translateY(-1px); }

.chip-locked {
    background: linear-gradient(135deg, #f0f3f6, #dde3e9);
    border-color: rgba(97, 107, 118, 0.22);
    color: #6a7585;
    cursor: not-allowed;
}

.dungeon-chip.is-preview { font-size: 0.78rem; padding: 0.35rem 0.72rem; }
.chip-name { font-weight: 700; }
.chip-count { font-size: 0.72rem; color: #7d6030; }

/* ── Tap-to-reveal Popup (bottom sheet / modal) ── */
.map-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 22, 28, .52);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 1000;
    animation: popup-fade .15s ease-out;
}
@keyframes popup-fade { from { opacity: 0; } to { opacity: 1; } }

.map-popup-card {
    position: relative;
    width: 100%;
    max-width: 480px;
    background: var(--paper);
    border-radius: 24px 24px 0 0;
    padding: 1.8rem 1.3rem 2.2rem;
    box-shadow: 0 -14px 36px rgba(0,0,0,.26);
    animation: popup-rise .22s cubic-bezier(.32,1.1,.4,1) both;
}
@media (min-width: 560px) {
    .map-popup-overlay { align-items: center; }
    .map-popup-card { border-radius: 24px; }
}
@keyframes popup-rise {
    from { transform: translateY(28px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

/* Drag handle */
.map-popup-card::before {
    content: "";
    position: absolute;
    top: 10px;
    left: 50%;
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: #dde3e9;
    transform: translateX(-50%);
}

.map-popup-close {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f0f2f5;
    color: #52606c;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}
.map-popup-close:hover { background: #e2e6eb; }

.map-popup-kicker {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: .08em;
    color: var(--momo-blue-deep);
    text-transform: uppercase;
    margin-top: 0.2rem;
}
.map-popup-title {
    font-size: 1.32rem;
    font-weight: 800;
    color: var(--ink-900);
    margin: 0.2rem 0 0.28rem;
    line-height: 1.3;
}
.map-popup-subtext {
    font-size: 0.86rem;
    color: #667288;
    margin-bottom: 1rem;
    line-height: 1.5;
}
.map-popup-lessons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 1.1rem;
}

.grammar-lesson-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    border: 1.5px solid #dde3e9;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    text-align: start;
    cursor: pointer;
    color: var(--ink-900);
    transition: background .12s, border-color .12s, transform .12s;
    width: 100%;
}
.grammar-lesson-btn:not(:disabled):hover {
    background: #f0f5ff;
    border-color: var(--momo-blue);
    transform: translateY(-1px);
}
.grammar-lesson-btn:disabled { cursor: not-allowed; opacity: .5; }

.map-popup-cta {
    width: 100%;
    border: none;
    border-radius: 14px;
    padding: 0.9rem;
    font-size: 1rem;
    font-weight: 800;
    font-family: inherit;
    color: #1a1a2e;
    background: linear-gradient(135deg, var(--momo-yellow) 0%, var(--momo-yellow-deep) 100%);
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(217, 138, 31, .35);
    transition: transform .15s, box-shadow .15s;
}
.map-popup-cta:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(217, 138, 31, .45);
}
.map-popup-cta:disabled {
    background: #dfe4ea;
    color: #8a94a3;
    box-shadow: none;
    cursor: not-allowed;
}

/* ── Responsive ── */
@media (max-width: 640px) {
    .world-map,
    .map-page {
        border-radius: 0;
        margin-bottom: 0;
        border-left: none;
        border-right: none;
        box-shadow: none;
    }

    .map-header { border-radius: 0; }

    .chapter-trail::before { display: none; }

    .offset-left,
    .offset-right {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
    }

    .branch-left {
        justify-content: flex-start;
        padding-left: 6%;
        padding-right: 0;
    }

    .branch-right {
        justify-content: flex-end;
        padding-left: 0;
        padding-right: 6%;
    }
}

@media (max-width: 520px) {
    .grammar-topic-heading {
        padding: 0.75rem 0.65rem 0.8rem;
    }

    .grammar-topic-heading h1 {
        font-size: 1.05rem;
    }

    .grammar-quiz-stats {
        gap: 0.45rem;
    }

    .grammar-quiz-stat {
        gap: 0.45rem;
        padding: 0.55rem 0.6rem;
    }

    .grammar-stat-icon {
        width: 1.8rem;
        height: 1.8rem;
        flex-basis: 1.8rem;
    }

    .grammar-stat-label {
        font-size: 0.6rem;
    }

    .grammar-stat-value {
        font-size: 0.9rem;
    }

    .grammar-token-option,
    .grammar-token-selected {
        min-height: 44px;
        font-size: 0.76rem;
        padding: 0.25rem 0.3rem;
        line-height: 1.1;
    }

    .grammar-token-pool {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 5px;
    }

    .dungeon-choices {
        grid-template-columns: 1fr;
    }

    .dungeon-choice {
        min-height: 72px;
        font-size: 1.03rem;
    }
}


/* ════════════════════════════════════════
   Character Reactions (喜怒哀樂)
   ════════════════════════════════════════ */

.character-reaction {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: reaction-pop .3s cubic-bezier(.36,1.6,.5,1) both;
}

.character-reaction-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,.18));
}

.character-reaction-fallback {
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    font-size: 2.4rem;
}

@keyframes reaction-pop {
    0%   { transform: scale(0.4) rotate(-8deg); opacity: 0; }
    70%  { transform: scale(1.12) rotate(2deg); }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

.feedback-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.feedback-row .dungeon-feedback,
.feedback-row .alert {
    flex: 1;
    margin-bottom: 0;
}

.japanese-ruby {
    ruby-position: over;
    ruby-align: center;
    white-space: nowrap;
}
.japanese-ruby rt {
    color: inherit;
    font-size: 0.42em;
    font-weight: 500;
    line-height: 1;
}
.grammar-correct-answer,
.dungeon-correct-answer {
    display: inline-flex;
    align-items: baseline;
    gap: 0.18em;
    margin-inline-start: 0.25rem;
}
.dungeon-word-kanji .japanese-ruby rt { color: #a8e6cf; }
.dungeon-answer-meaning { font-size: 0.9em; }

.completion-character {
    display: flex;
    justify-content: center;
    margin-bottom: 0.4rem;
}
.completion-character .character-reaction {
    width: 96px;
    height: 96px;
}

.completion-video-shell {
    width: min(100%, 360px);
    margin: 0.75rem auto 0;
}
.completion-video {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border: 1px solid #dfe6e9;
    border-radius: 8px;
    background: #f8f9fa;
}

/* Theme settings */
.theme-mode-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
}

.theme-mode-option {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 0.65rem;
    padding: 0.75rem;
    border: 1.5px solid var(--border-strong);
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--ink-900);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.theme-mode-option:hover {
    border-color: var(--momo-blue);
    transform: translateY(-1px);
}

.theme-mode-option.is-selected {
    border-color: var(--momo-yellow-deep);
    background: linear-gradient(135deg, rgba(244, 185, 66, 0.16), rgba(63, 143, 209, 0.11));
    box-shadow: 0 0 0 2px rgba(244, 185, 66, 0.12);
}

.theme-mode-icon {
    display: inline-flex;
    width: 2rem;
    height: 2rem;
    flex: 0 0 2rem;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #fff2c7;
    color: #9b6400;
    font-size: 1.15rem;
}

.theme-mode-icon-dark {
    background: #26384c;
    color: #f7c85c;
}

.theme-mode-copy {
    display: grid;
    min-width: 0;
    gap: 0.15rem;
}

.theme-mode-copy strong,
.theme-mode-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
}

.theme-mode-copy strong {
    font-size: 0.84rem;
}

.theme-mode-copy small {
    color: var(--text-soft);
    font-size: 0.7rem;
    line-height: 1.35;
}

.theme-mode-check {
    width: 1.25rem;
    flex: 0 0 1.25rem;
    color: var(--momo-yellow-deep);
    font-weight: 800;
    text-align: center;
}

@media (max-width: 420px) {
    .theme-mode-grid {
        grid-template-columns: 1fr;
    }
}

/* Night Trail: preserve level and character accents on a quieter canvas. */
html[data-theme="dark"] {
    --ink-900: #f2f5f8;
    --ink-700: #c0ccd8;
    --paper: #18232e;
    --paper-soft: #202d39;
    --line-soft: rgba(194, 214, 232, 0.18);
    --surface-1: #1c2935;
    --surface-2: #233341;
    --surface-3: #2d3e4d;
    --text-soft: #aab9c8;
    --border-strong: rgba(182, 207, 229, 0.3);
    --profile-panel-bg: #182633;
    --profile-panel-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
    --profile-heading-bg: linear-gradient(110deg, #24394a, #2c4050);
    --profile-row-bg: #1b2a37;
    --profile-row-hover-bg: #263b4b;
    --profile-preview-bg: #253543;
    --profile-unavailable-bg: #29343d;
}

html[data-theme="dark"],
html[data-theme="dark"] body {
    background:
        radial-gradient(circle at 8% 0%, rgba(244, 185, 66, 0.09) 0%, transparent 32%),
        radial-gradient(circle at 92% 8%, rgba(63, 143, 209, 0.15) 0%, transparent 34%),
        linear-gradient(180deg, #101922 0%, #15212c 55%, #101820 100%);
    color: var(--ink-900);
}

html[data-theme="dark"] body {
    color-scheme: dark;
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .dropdown-menu {
    border-color: var(--border-strong);
    background-color: var(--surface-1);
    color: var(--ink-900);
}

html[data-theme="dark"] .mistake-book-kicker {
    color: #f2c75c;
}

html[data-theme="dark"] .mistake-book-heading h6 {
    color: var(--ink-900);
}

html[data-theme="dark"] .mistake-book-total {
    color: #b8c7d5;
}

html[data-theme="dark"] .mistake-book-total strong {
    color: #7fc1f0;
}

html[data-theme="dark"] .source-grammar {
    color: #9bd9f5;
    background: #20475e;
}

html[data-theme="dark"] .source-word {
    color: #f4d48a;
    background: #4a3b20;
}

html[data-theme="dark"] .mistake-answer,
html[data-theme="dark"] .mistake-word-line span {
    color: #8ecaff;
}

html[data-theme="dark"] .mistake-stat-wrong strong,
html[data-theme="dark"] .mistake-stat-rate strong {
    color: #ff8b92;
}

html[data-theme="dark"] .mistake-stat-correct strong {
    color: #6ed6a1;
}

html[data-theme="dark"] .mistake-practice-btn {
    background: #2e7fbb;
}

html[data-theme="dark"] .mistake-practice-btn:hover:not(:disabled) {
    background: #4b9ed4;
}

html[data-theme="dark"] .text-muted {
    color: var(--text-soft) !important;
}

html[data-theme="dark"] .bg-light,
html[data-theme="dark"] .bg-white {
    background-color: var(--surface-2) !important;
}

html[data-theme="dark"] .text-dark {
    color: var(--ink-900) !important;
}

html[data-theme="dark"] a,
html[data-theme="dark"] .btn-link {
    color: #83c5f6;
}

html[data-theme="dark"] .btn-primary {
    background-color: #2e7fbb;
    border-color: #55a5dd;
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select {
    border-color: var(--border-strong);
    background-color: #17232e;
    color: var(--ink-900);
}

html[data-theme="dark"] .form-control::placeholder {
    color: #8293a5;
}

html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus {
    border-color: #68b5ee;
    background-color: #1b2935;
    color: var(--ink-900);
}

html[data-theme="dark"] .form-select option {
    background-color: #17232e;
    color: var(--ink-900);
}

html[data-theme="dark"] .alert-light {
    border-color: var(--border-strong);
    background-color: var(--surface-2);
    color: var(--ink-900);
}

html[data-theme="dark"] .table {
    --bs-table-color: var(--ink-900);
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--border-strong);
}

html[data-theme="dark"] .mode-btn,
html[data-theme="dark"] .answer-zone {
    border-color: var(--border-strong);
    background: var(--surface-1);
    color: var(--ink-900);
}

html[data-theme="dark"] .mode-locked {
    background: #27333e;
}

html[data-theme="dark"] .prompt-box {
    background: #203346;
    color: var(--ink-900);
}

html[data-theme="dark"] .grammar-quiz-card {
    background:
        radial-gradient(circle at 85% 8%, rgba(244, 185, 66, 0.14) 0%, transparent 36%),
        radial-gradient(circle at 12% 0%, rgba(63, 143, 209, 0.16) 0%, transparent 34%),
        linear-gradient(170deg, #1d2a36 0%, #1a2631 100%);
    border-color: rgba(213, 171, 97, 0.42);
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.25);
}

html[data-theme="dark"] .grammar-topic-heading {
    border-color: rgba(213, 171, 97, 0.42);
    background: linear-gradient(135deg, rgba(62, 52, 35, 0.94), rgba(31, 57, 78, 0.96));
}

html[data-theme="dark"] .grammar-topic-eyebrow {
    color: #e9c978;
}

html[data-theme="dark"] .grammar-topic-heading h1 {
    color: #f3f6f8;
}

html[data-theme="dark"] .grammar-quiz-stat {
    border-color: rgba(187, 206, 222, 0.25);
    background: rgba(36, 52, 66, 0.86);
}

html[data-theme="dark"] .grammar-hp-stat {
    border-color: rgba(255, 139, 146, 0.34);
    background: rgba(78, 42, 48, 0.72);
}

html[data-theme="dark"] .grammar-progress-stat {
    border-color: rgba(112, 184, 233, 0.38);
    background: rgba(31, 57, 78, 0.86);
}

html[data-theme="dark"] .grammar-premium-stat {
    border-color: rgba(233, 201, 120, 0.38);
    background: rgba(73, 59, 32, 0.72);
}

html[data-theme="dark"] .grammar-stat-icon {
    background: rgba(12, 24, 35, 0.42);
}

html[data-theme="dark"] .grammar-stat-label,
html[data-theme="dark"] .grammar-stat-value small {
    color: #b8c7d5;
}

html[data-theme="dark"] .grammar-stat-value {
    color: #f3f6f8;
}

html[data-theme="dark"] .grammar-character-strip {
    background: rgba(26, 38, 49, 0.86);
    border-color: rgba(187, 206, 222, 0.25);
}

html[data-theme="dark"] .grammar-character-label {
    color: #e9c978;
}

html[data-theme="dark"] .grammar-prompt-box {
    border-color: rgba(107, 170, 218, 0.42);
    background: linear-gradient(180deg, rgba(31, 57, 78, 0.96), rgba(27, 48, 67, 0.9));
}

html[data-theme="dark"] .grammar-pronunciation-btn-normal {
    background: transparent;
    color: #e9f5ff;
}

html[data-theme="dark"] .grammar-pronunciation-btn-normal:hover {
    background: rgba(49, 111, 157, 0.42);
}

html[data-theme="dark"] .grammar-pronunciation-btn-slow {
    background: transparent;
    color: #fff0bd;
}

html[data-theme="dark"] .grammar-pronunciation-btn-slow:hover {
    background: rgba(132, 96, 31, 0.48);
}

html[data-theme="dark"] .grammar-answer-zone {
    border-color: rgba(191, 159, 105, 0.4) !important;
    background: linear-gradient(180deg, rgba(33, 45, 55, 0.98), rgba(28, 39, 48, 0.98));
}

html[data-theme="dark"] .grammar-token-option {
    border-color: #526577;
    background: #243442;
    color: #eef4fa;
}

html[data-theme="dark"] .grammar-token-option:hover:not(:disabled) {
    border-color: #70b8e9;
    background: #2d465b;
}

html[data-theme="dark"] .grammar-token-option.is-selected,
html[data-theme="dark"] .grammar-token-option:disabled {
    border-color: #66717b;
    background: #4a545c;
    color: #b7c0c8;
}

html[data-theme="dark"] .grammar-token-selected {
    border-color: #69b5e9;
    background: linear-gradient(135deg, #347eaf, #24587f);
}

html[data-theme="dark"] .btn-tts {
    border-color: #6b7e8f;
    color: #dce9f5;
}

html[data-theme="dark"] .btn-tts:hover {
    background: #29435a;
}

html[data-theme="dark"] .dungeon-stat,
html[data-theme="dark"] .dungeon-choice,
html[data-theme="dark"] .dungeon-score-card,
html[data-theme="dark"] .dungeon-exit-btn,
html[data-theme="dark"] .dungeon-return-btn {
    border-color: var(--border-strong);
    background: var(--surface-1);
    color: var(--ink-900);
}

html[data-theme="dark"] .dungeon-stat,
html[data-theme="dark"] .score-row,
html[data-theme="dark"] .dungeon-exit-btn {
    color: var(--text-soft);
}

html[data-theme="dark"] .dungeon-return-btn:hover,
html[data-theme="dark"] .dungeon-exit-btn:hover {
    background: var(--surface-3);
}

html[data-theme="dark"] .dungeon-back-link {
    color: #9fb0bf;
}

html[data-theme="dark"] .dungeon-back-link:hover {
    color: #f0c65b;
}

html[data-theme="dark"] .dungeon-dots .dot-todo,
html[data-theme="dark"] .dungeon-combo.combo-normal,
html[data-theme="dark"] .dungeon-timer-track {
    background: #334453;
}

html[data-theme="dark"] .dungeon-choice:hover:not(:disabled) {
    border-color: #e3b653;
    background: #3b3528;
}

html[data-theme="dark"] .dc-correct,
html[data-theme="dark"] .fb-ok {
    border-color: #38c996 !important;
    background: #163f35 !important;
    color: #baf2db !important;
}

html[data-theme="dark"] .dc-wrong,
html[data-theme="dark"] .fb-x {
    border-color: #eb777e !important;
    background: #48262e !important;
    color: #ffc4c7 !important;
}

html[data-theme="dark"] .result-title,
html[data-theme="dark"] .score-val {
    color: var(--ink-900);
}

html[data-theme="dark"] .result-subtitle {
    color: var(--text-soft);
}

html[data-theme="dark"] .daily-item {
    background: #2d3b48;
    color: #c4d0dc;
}

html[data-theme="dark"] .daily-done {
    background: #194538;
    color: #a9e8ca;
}

html[data-theme="dark"] .wm-hero {
    background: linear-gradient(130deg, #1d2b37 0%, #213c50 100%);
    box-shadow: 0 2px 18px rgba(0, 0, 0, 0.22);
}

html[data-theme="dark"] .wm-hero-subtitle,
html[data-theme="dark"] .wm-hero-title {
    color: var(--ink-900);
}

html[data-theme="dark"] .wm-login-reminder {
    border-color: rgba(240, 195, 109, 0.5);
    background: #3b321f;
    color: #f5d98c;
}

html[data-theme="dark"] .hp-banner {
    border-color: #9f555d;
    background: #40272d;
    color: #ffbec2;
}

html[data-theme="dark"] .hp-banner-btn {
    border-color: #9f555d;
    background: #512e34;
    color: #ffc6ca;
}

html[data-theme="dark"] .hp-banner-btn:hover {
    background: #63383e;
}

html[data-theme="dark"] .hp-banner-premium {
    border-color: #b18b39;
    color: #ffe6a1;
}

html[data-theme="dark"] .hp-banner-premium:hover {
    background: #55451f;
}

html[data-theme="dark"] .exp-track,
html[data-theme="dark"] .conn-unlocked {
    background: #354554;
}

html[data-theme="dark"] .wm-active {
    box-shadow: 0 0 0 3px var(--surface-1), 0 0 0 6px rgba(255, 200, 0, 0.65),
        0 8px 24px rgba(0, 0, 0, 0.35) !important;
}

html[data-theme="dark"] .cta-pulse {
    background: #f0c35b;
    color: #1d2730;
}

html[data-theme="dark"] .wdl-title,
html[data-theme="dark"] .map-popup-title {
    color: var(--ink-900);
}

html[data-theme="dark"] .wdl-chips,
html[data-theme="dark"] .wdl-loading {
    background: #1b2935;
}

html[data-theme="dark"] .vocab-section {
    background: linear-gradient(165deg, rgba(55, 46, 28, 0.95), rgba(45, 40, 27, 0.9));
    border-color: rgba(227, 169, 67, 0.52);
    box-shadow: 0 12px 22px rgba(0, 0, 0, 0.2);
}

html[data-theme="dark"] .vocab-section-header,
html[data-theme="dark"] .vocab-theme-title,
html[data-theme="dark"] .vocab-theme-header {
    color: #f3d486;
}

html[data-theme="dark"] .vocab-theme-card {
    background: rgba(34, 39, 40, 0.82);
    border-color: rgba(210, 159, 60, 0.4);
}

html[data-theme="dark"] .vocab-theme-header:hover {
    background: rgba(255, 220, 125, 0.1);
}

html[data-theme="dark"] .vocab-theme-meta,
html[data-theme="dark"] .vocab-preview-more,
html[data-theme="dark"] .vocab-section-count {
    color: #d5aa58;
}

html[data-theme="dark"] .dungeon-chip,
html[data-theme="dark"] .dungeon-inline-chip:not(.dic-locked):not(.dic-cleared) {
    background: linear-gradient(135deg, #554321, #725c28);
    border-color: rgba(244, 193, 78, 0.55);
    color: #fff0bd;
    box-shadow: 0 3px 9px rgba(0, 0, 0, 0.2);
}

html[data-theme="dark"] .dungeon-chip .chip-count,
html[data-theme="dark"] .chip-count,
html[data-theme="dark"] .dic-stars {
    color: #f3d789;
}

html[data-theme="dark"] .chip-locked,
html[data-theme="dark"] .dic-locked,
html[data-theme="dark"] .node-locked,
html[data-theme="dark"] .dungeon-node.dungeon-btn-locked,
html[data-theme="dark"] .chapter-card-locked {
    background: linear-gradient(145deg, #2b3640, #202b34);
    border-color: rgba(154, 174, 191, 0.35);
    color: #9eafbd;
}

html[data-theme="dark"] .dic-cleared {
    background: linear-gradient(135deg, #1d503e, #27694d);
    border-color: rgba(78, 206, 142, 0.45);
    color: #c0f1d5;
}

html[data-theme="dark"] .map-page {
    background:
        radial-gradient(circle at 15% 8%, rgba(244, 185, 66, 0.11) 0%, transparent 36%),
        radial-gradient(circle at 85% 12%, rgba(63, 143, 209, 0.14) 0%, transparent 34%),
        linear-gradient(180deg, #1a2732 0%, #17232d 100%);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] .chapter-card-cleared {
    background: linear-gradient(160deg, #1c3546, #1b2d3c);
    border-color: rgba(94, 174, 226, 0.38);
}

html[data-theme="dark"] .chapter-card-current {
    background: linear-gradient(160deg, #44391f, #332d1d);
    border-color: rgba(244, 185, 66, 0.58);
}

html[data-theme="dark"] .chapter-card-current.card-char-momo {
    background: linear-gradient(160deg, #34404a, #26313a);
    border-color: rgba(200, 215, 227, 0.46);
}

html[data-theme="dark"] .chapter-card-current.card-char-ichi {
    background: linear-gradient(160deg, #4a2e43, #352333);
    border-color: rgba(236, 111, 170, 0.62);
}

html[data-theme="dark"] .chapter-card-current.card-char-ken {
    background: linear-gradient(160deg, #4a2d32, #342328);
    border-color: rgba(233, 108, 108, 0.58);
}

html[data-theme="dark"] .chapter-card-current.card-char-lion {
    background: linear-gradient(160deg, #51431d, #392f1a);
    border-color: rgba(241, 193, 62, 0.62);
}

html[data-theme="dark"] .chapter-card-current.card-char-teacher {
    background: linear-gradient(160deg, #294361, #203349);
    border-color: rgba(111, 174, 247, 0.58);
}

html[data-theme="dark"] .chapter-card-cleared.card-char-momo {
    background: linear-gradient(160deg, #2c3740, #242e36);
}

html[data-theme="dark"] .chapter-card-cleared.card-char-ichi {
    background: linear-gradient(160deg, #3b2938, #2d222d);
}

html[data-theme="dark"] .chapter-card-cleared.card-char-ken {
    background: linear-gradient(160deg, #3c292d, #2d2226);
}

html[data-theme="dark"] .chapter-card-cleared.card-char-lion {
    background: linear-gradient(160deg, #44391d, #332d1b);
}

html[data-theme="dark"] .chapter-card-cleared.card-char-teacher {
    background: linear-gradient(160deg, #273c55, #203247);
}

html[data-theme="dark"] .chapter-card-title,
html[data-theme="dark"] .chapter-card-focus {
    color: var(--ink-900);
}

html[data-theme="dark"] .chapter-card-focus {
    color: #b6c3d0;
}

html[data-theme="dark"] .inline-grammar-btn {
    border-color: rgba(174, 198, 218, 0.28);
    background: rgba(27, 40, 51, 0.9);
    color: #edf3f8;
}

html[data-theme="dark"] .inline-grammar-btn:not(:disabled):hover,
html[data-theme="dark"] .grammar-lesson-btn:not(:disabled):hover {
    background: #29445b;
    border-color: #66abe0;
}

html[data-theme="dark"] .igb-cleared,
html[data-theme="dark"] .card-char-momo .igb-cleared,
html[data-theme="dark"] .card-char-ichi .igb-cleared,
html[data-theme="dark"] .card-char-ken .igb-cleared,
html[data-theme="dark"] .card-char-lion .igb-cleared,
html[data-theme="dark"] .card-char-teacher .igb-cleared {
    border-color: rgba(57, 197, 137, 0.42);
    border-left-color: #37c98d;
    background: rgba(24, 70, 55, 0.9);
    color: #b9efd3;
}

html[data-theme="dark"] .igb-current,
html[data-theme="dark"] .card-char-momo .igb-current,
html[data-theme="dark"] .card-char-ichi .igb-current,
html[data-theme="dark"] .card-char-ken .igb-current,
html[data-theme="dark"] .card-char-lion .igb-current,
html[data-theme="dark"] .card-char-teacher .igb-current {
    border-color: rgba(242, 190, 80, 0.52);
    border-left-color: #e4b33f;
    background: rgba(65, 53, 27, 0.92);
    color: #ffe6a2;
}

html[data-theme="dark"] .chapter-card-current.card-char-ichi .igb-current {
    border-color: rgba(244, 114, 182, 0.62);
    border-left-color: #ec6fae;
    background: rgba(71, 38, 61, 0.96);
    color: #ffd1e8;
}

html[data-theme="dark"] .chapter-card-current.card-char-ichi .igb-cleared {
    background: rgba(24, 70, 55, 0.94);
    color: #b9efd3;
}

html[data-theme="dark"] .chapter-dungeon-row {
    border-top-color: rgba(187, 204, 219, 0.14);
}

html[data-theme="dark"] .chapter-locked-hint,
html[data-theme="dark"] .map-popup-subtext {
    color: #aab9c8;
}

html[data-theme="dark"] .trail-connector,
html[data-theme="dark"] .chapter-trail::before {
    background: linear-gradient(180deg, #516577, #344553);
}

html[data-theme="dark"] .node-index-badge,
html[data-theme="dark"] .dungeon-node-star {
    border-color: #1b2834;
}

html[data-theme="dark"] .map-hint-banner {
    border-color: rgba(226, 169, 91, 0.52);
    background: #3e3020;
    color: #f1ce91;
}

html[data-theme="dark"] .map-popup-card {
    background: var(--paper);
    color: var(--ink-900);
}

html[data-theme="dark"] .map-popup-card::before {
    background: #617486;
}

html[data-theme="dark"] .map-popup-close {
    background: #2b3b4a;
    color: #d3e0eb;
}

html[data-theme="dark"] .map-popup-close:hover {
    background: #3a5062;
}

html[data-theme="dark"] .grammar-lesson-btn {
    border-color: var(--border-strong);
    background: #223341;
    color: var(--ink-900);
}

html[data-theme="dark"] .completion-video {
    border-color: var(--border-strong);
    background: #17232e;
}

html[data-theme="dark"] .loading-progress circle {
    stroke: #3c5061;
}

html[data-theme="dark"] .loading-progress circle:last-child {
    stroke: #f0bd4f;
}

html[data-theme="dark"] code {
    color: #f08ab5;
}

.world-map {
    max-width: 760px;
    padding: 1.25rem 1rem 4rem;
}

.wm-hero {
    min-height: 168px;
    margin-bottom: 1rem;
    padding: 1.45rem 1.5rem;
    border: 1px solid rgba(28, 93, 148, 0.2);
    border-left: 5px solid var(--momo-yellow-deep);
    border-radius: 22px;
    background:
        linear-gradient(118deg, rgba(255, 255, 255, 0.92), rgba(237, 247, 255, 0.78)),
        repeating-linear-gradient(135deg, transparent 0 18px, rgba(63, 143, 209, 0.06) 18px 20px);
    box-shadow: 0 14px 30px rgba(55, 83, 109, 0.12);
}

.wm-hero-copy {
    max-width: 68%;
}

.wm-hero-title {
    font-size: 2.1rem;
    letter-spacing: 0;
    line-height: 1.15;
}

.wm-hero-subtitle {
    max-width: 25rem;
    margin-top: 0.55rem;
    font-size: 0.95rem;
    line-height: 1.6;
}

.wm-hero-logo {
    flex-basis: 142px;
    width: 142px;
    height: 112px;
    opacity: 1;
    filter: drop-shadow(0 8px 8px rgba(28, 31, 38, 0.12));
}

.wm-login-reminder,
.wm-premium-reminder {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 0 1rem;
    padding: 1rem 1.1rem;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(99, 78, 28, 0.08);
}

.wm-login-reminder {
    border: 1px solid rgba(63, 143, 209, 0.28);
    background: linear-gradient(110deg, #eef8ff, #ffffff);
    color: #194c76;
}

.wm-premium-reminder {
    border: 1px solid rgba(217, 138, 31, 0.48);
    background: linear-gradient(110deg, #fff8dc, #fffdf4);
    color: #5e470f;
}

.wm-login-reminder-copy,
.wm-premium-reminder-copy {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    min-width: 0;
}

.wm-login-reminder-copy > div,
.wm-premium-reminder-copy > div {
    min-width: 0;
}

.wm-login-reminder-copy strong,
.wm-login-reminder-copy span:last-child,
.wm-premium-reminder-copy strong,
.wm-premium-reminder-copy > div > span {
    display: block;
}

.wm-login-reminder-copy span:last-child,
.wm-premium-reminder-copy > div > span {
    margin-top: 0.2rem;
    font-size: 0.82rem;
    line-height: 1.45;
}

.wm-login-reminder-icon,
.wm-premium-reminder-icon {
    flex: 0 0 auto;
    font-size: 1.45rem;
    line-height: 1.15;
}

.wm-premium-reminder-icon {
    color: var(--momo-yellow-deep);
}

.wm-premium-benefits {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.8rem;
    margin-top: 0.5rem;
    color: #795f16;
    font-size: 0.76rem;
    font-weight: 800;
}

.wm-login-reminder-btn,
.wm-premium-reminder-btn {
    flex: 0 0 auto;
    border: 0;
    border-radius: 10px;
    padding: 0.6rem 0.9rem;
    color: #fff;
    font-family: inherit;
    font-weight: 800;
    line-height: 1.25;
    white-space: nowrap;
    transition: transform 0.15s ease, filter 0.15s ease;
}

.wm-login-reminder-btn {
    background: var(--momo-blue-deep);
}

.wm-premium-reminder-btn {
    background: var(--momo-yellow-deep);
}

.wm-login-reminder-btn:hover,
.wm-premium-reminder-btn:hover {
    filter: brightness(0.92);
    transform: translateY(-1px);
}

.wm-status-panel {
    margin-bottom: 1rem;
    padding: 1rem 1.1rem 0.95rem;
    border: 1px solid rgba(28, 93, 148, 0.18);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 12px 26px rgba(57, 71, 88, 0.08);
}

.wm-header {
    margin-bottom: 1rem;
    padding: 0.05rem 0.05rem 0.85rem;
    border-bottom: 1px solid rgba(28, 31, 38, 0.1);
}

.wm-streak {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: #687789;
    font-size: 0.86rem;
    font-weight: 800;
}

.wm-streak-icon {
    font-size: 1rem;
}

.streak-active {
    color: #c75b37;
}

.wm-lv-info {
    color: var(--ink-900);
    font-size: 1rem;
}

.wm-hp-card {
    padding: 0.95rem 1rem;
    border: 1px solid rgba(63, 143, 209, 0.18);
    border-radius: 15px;
    background: linear-gradient(135deg, rgba(238, 248, 255, 0.86), rgba(255, 255, 255, 0.92));
}

.wm-hp-card-empty {
    border-color: rgba(194, 59, 75, 0.4);
    background: linear-gradient(135deg, #fff2f0, #fffafa);
}

.wm-hp-heading,
.wm-hp-meta,
.wm-exp-labels {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.wm-hp-heading h2 {
    margin: 0;
    color: var(--ink-900);
    font-size: 1rem;
    font-weight: 800;
}

.wm-hp {
    display: flex;
    gap: 0.15rem;
    white-space: nowrap;
}

.wm-hp .hp-full,
.wm-hp .hp-empty {
    font-size: 1.15rem;
}

.wm-hp .hp-full {
    color: #e84c68;
}

.wm-hp-meta {
    align-items: baseline;
    margin-top: 0.45rem;
    color: #687789;
    font-size: 0.78rem;
}

.wm-hp-meta p {
    margin: 0;
}

.wm-hp-meta span {
    text-align: right;
}

.wm-hp-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.wm-exp-section {
    margin: 1rem 0 0;
}

.wm-exp-labels {
    color: #687789;
    font-size: 0.75rem;
    font-weight: 800;
}

.exp-track {
    height: 10px;
    margin-top: 0.4rem !important;
    background: #dfe9f0;
    border-radius: 999px;
}

.exp-fill {
    background: linear-gradient(90deg, var(--momo-yellow-deep), var(--momo-blue));
}

.wm-daily-bar {
    gap: 0.45rem;
    margin: 0 0 0.9rem;
    padding: 0 0.1rem;
}

.daily-item {
    border: 1px solid rgba(28, 31, 38, 0.1);
    background: rgba(255, 255, 255, 0.62);
    color: #687789;
    font-size: 0.74rem;
}

.daily-done {
    border-color: rgba(46, 125, 80, 0.22);
    background: #e5f6ec;
    color: #2e7d50;
}

.daily-hint {
    border: 0;
    background: transparent;
    color: #8d9aaa;
}

.wm-hint-banner {
    margin: 0 0 0.9rem;
    border: 1px solid #f1c68b;
    border-radius: 12px;
    background: #fff3e1;
    color: #7a3417;
}

.wm-path {
    gap: 0.7rem;
}

.wm-level-card {
    min-height: 122px;
    padding: 1rem 1.1rem;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 20px;
    box-shadow: 0 8px 20px rgba(55, 71, 88, 0.14);
}

.wm-level-card:hover:not(.wm-locked) {
    box-shadow: 0 13px 26px rgba(55, 71, 88, 0.2) !important;
}

.wm-card-emoji {
    width: 3.1rem;
    font-size: 2.55rem;
    text-align: center;
}

.wm-card-desc {
    margin-top: 0.2rem;
    line-height: 1.45;
}

.wm-progress-row {
    margin-top: 0.7rem !important;
}

.wm-mini-bar {
    height: 7px;
}

.wm-card-cta {
    padding: 0.45rem 0.8rem;
    border-radius: 11px;
}

.wm-active {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.96), 0 0 0 6px rgba(217, 138, 31, 0.68), 0 12px 26px rgba(55, 71, 88, 0.18) !important;
}

.wm-connector {
    padding: 0.1rem 0;
}

.conn-unlocked,
.conn-locked {
    height: 18px;
}

@media (max-width: 576px) {
    .world-map {
        padding-right: 0.8rem;
        padding-left: 0.8rem;
    }

    .wm-hero {
        min-height: 142px;
        padding: 1.1rem 1rem;
        border-radius: 18px;
    }

    .wm-hero-copy {
        max-width: 70%;
    }

    .wm-hero-title {
        font-size: 1.7rem;
    }

    .wm-hero-subtitle {
        font-size: 0.82rem;
    }

    .wm-hero-logo {
        flex-basis: 88px;
        width: 88px;
        height: 76px;
    }

    .wm-login-reminder,
    .wm-premium-reminder {
        align-items: flex-start;
        flex-direction: column;
    }

    .wm-login-reminder-btn,
    .wm-premium-reminder-btn {
        align-self: flex-end;
    }

    .wm-status-panel {
        padding: 0.85rem;
        border-radius: 17px;
    }

    .wm-hp-meta {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.15rem;
    }

    .wm-hp-meta span {
        text-align: left;
    }

    .wm-level-card {
        min-height: 116px;
        padding: 0.85rem;
    }

    .wm-card-emoji {
        width: 2.6rem;
        font-size: 2.1rem;
    }

    .wm-card-cta {
        padding-right: 0.6rem;
        padding-left: 0.6rem;
        font-size: 0.75rem;
    }
}

html[data-theme="dark"] .wm-hero {
    border-color: rgba(164, 199, 226, 0.22);
    border-left-color: #e2aa3d;
    background:
        linear-gradient(118deg, rgba(29, 48, 63, 0.98), rgba(32, 60, 80, 0.96)),
        repeating-linear-gradient(135deg, transparent 0 18px, rgba(164, 199, 226, 0.06) 18px 20px);
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.24);
}

html[data-theme="dark"] .wm-login-reminder {
    border-color: rgba(105, 177, 224, 0.38);
    background: linear-gradient(110deg, #1e3a4d, #223341);
    color: #c8eaff;
}

html[data-theme="dark"] .wm-premium-reminder {
    border-color: rgba(226, 170, 61, 0.52);
    background: linear-gradient(110deg, #3e351f, #302d26);
    color: #ffe6a1;
}

html[data-theme="dark"] .wm-premium-benefits {
    color: #f2c96e;
}

html[data-theme="dark"] .wm-status-panel {
    border-color: rgba(182, 207, 229, 0.22);
    background: rgba(28, 41, 53, 0.82);
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.2);
}

html[data-theme="dark"] .wm-header {
    border-bottom-color: rgba(194, 214, 232, 0.16);
}

html[data-theme="dark"] .wm-streak,
html[data-theme="dark"] .wm-hp-meta,
html[data-theme="dark"] .wm-exp-labels {
    color: var(--text-soft);
}

html[data-theme="dark"] .wm-hp-card {
    border-color: rgba(105, 177, 224, 0.24);
    background: linear-gradient(135deg, #203746, #1d2e3b);
}

html[data-theme="dark"] .wm-hp-card-empty {
    border-color: rgba(235, 119, 126, 0.46);
    background: linear-gradient(135deg, #40272d, #33252b);
}

html[data-theme="dark"] .exp-track {
    background: #354554;
}

html[data-theme="dark"] .daily-item {
    border-color: rgba(194, 214, 232, 0.18);
    background: #2d3b48;
    color: #c4d0dc;
}

html[data-theme="dark"] .daily-done {
    border-color: rgba(91, 201, 150, 0.28);
    background: #194538;
    color: #a9e8ca;
}

html[data-theme="dark"] .daily-hint {
    border-color: transparent;
    background: transparent;
    color: #8fa1b2;
}

html[data-theme="dark"] .wm-hint-banner {
    border-color: rgba(241, 198, 139, 0.35);
    background: #3a3024;
    color: #f2cd9b;
}

html[data-theme="dark"] .wm-level-card {
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] .wm-active {
    box-shadow: 0 0 0 3px var(--surface-1), 0 0 0 6px rgba(255, 200, 0, 0.68), 0 12px 26px rgba(0, 0, 0, 0.36) !important;
}

html[data-theme="dark"] .cta-pulse {
    background: #f0c35b;
    color: #25282d;
}

html[data-theme="dark"] .wm-n5,
html[data-theme="dark"] .map-n5 {
    background: linear-gradient(135deg, #5b4325 0%, #7b5424 100%);
}

html[data-theme="dark"] .wm-n5 {
    border-color: rgba(244, 185, 66, 0.4);
}
