@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);
}

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-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-topic-badge {
    background: linear-gradient(135deg, #375a7f, #4f7ead);
    border: none;
    color: #fff;
    font-size: 0.74rem;
    max-width: 48%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.grammar-meta {
    font-size: 0.86rem;
    font-weight: 700;
    color: #5a4b34;
}

.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-character-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #6c4d1f;
}

.grammar-prompt-box {
    border: 1.5px solid rgba(98, 137, 180, 0.28);
    background: linear-gradient(180deg, rgba(238, 247, 255, 0.94), rgba(224, 239, 255, 0.82));
}

.answer-zone {
    min-height: 52px;
    background: #fff;
    border-radius: 8px;
}

.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: 52px;
    border-radius: 13px;
    padding: 0.5rem 0.7rem;
    font-size: 0.94rem;
    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-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.2rem 0 0.7rem;
    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-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-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; }
.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; }

/* 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;
}

@media (max-width: 576px) {
    .wm-hero {
        gap: 0.5rem;
    }

    .wm-hero-logo {
        flex-basis: 72px;
        width: 72px;
        height: 52px;
    }
}

/* 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-badge {
        max-width: 44%;
        font-size: 0.68rem;
    }

    .grammar-meta {
        font-size: 0.79rem;
    }

    .grammar-token-option,
    .grammar-token-selected {
        min-height: 56px;
        font-size: 0.9rem;
        padding: 0.5rem 0.55rem;
    }

    .grammar-token-pool {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .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;
}

.completion-character {
    display: flex;
    justify-content: center;
    margin-bottom: 0.4rem;
}
.completion-character .character-reaction {
    width: 96px;
    height: 96px;
}
