/* ========================================
   忍者練習介面 (Ninja Quiz Interface)
   書道挑戰 - 卷軸內的決鬥
   ======================================== */

/* Google Fonts - 手寫風英文字體 */
@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;600&display=swap');

/* ========================================
   練習區域容器
   ======================================== */

#quiz-area.active {
    display: block;
}

/* 練習卷軸容器 */
.ninja-quiz-scroll {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
    padding: 0 1rem;
    filter: drop-shadow(0 25px 50px rgba(0, 0, 0, 0.15));
}

@media (min-width: 768px) {
    .ninja-quiz-scroll {
        padding: 0;
    }
}

/* 結算卷軸 - 加寬版 */
.result-scroll-wide {
    max-width: 100%;
}

@media (min-width: 768px) {
    .result-scroll-wide {
        max-width: 896px;
    }
}

/* ========================================
   兩階段結算展演
   ======================================== */

/* 🔴 階段一：所長講評 - 破框版 */
.result-stage-verdict {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 450px;
    padding: 1rem;
    animation: verdict-fade-in 0.5s ease-out;
}

@keyframes verdict-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 破框佈局容器 */
.verdict-breakout {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 500px;
}

/* 桌面版：橫向佈局 */
@media (min-width: 768px) {
    .verdict-breakout {
        flex-direction: row;
        align-items: flex-end;
        justify-content: center;
        max-width: 700px;
    }
}

/* 🐱 Q北自由站立 - The Hero */
.verdict-hero {
    width: 260px;
    height: 260px;
    z-index: 10;
    animation: hero-entrance 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
    /* 無邊框、無背景、無陰影 - 讓去背發揮作用 */
}

@media (min-width: 768px) {
    .verdict-hero {
        width: 340px;
        height: 340px;
    }
}

@keyframes hero-entrance {
    0% {
        opacity: 0;
        transform: translateY(60px) scale(0.6);
    }
    60% {
        transform: translateY(-15px) scale(1.05);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.verdict-hero img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* 只有微微的投影，不要框 */
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.15));
}

/* 💬 浮動對話氣泡 - 不包住 Q北 */
.verdict-floating-bubble {
    position: relative;
    z-index: 20;
    background: white;
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    text-align: center;
    max-width: 300px;
    overflow: hidden;
    animation: bubble-float-in 0.5s ease-out 0.5s both;
    
    /* 手機版：氣泡在上方，往下重疊 Q北 */
    order: -1;
    margin-bottom: -30px;
}

@media (min-width: 768px) {
    .verdict-floating-bubble {
        order: 0;
        margin-bottom: 0;
        /* 桌面版：氣泡往左重疊 Q北 身體 */
        margin-left: -50px;
        margin-bottom: 60px;
    }
}

@keyframes bubble-float-in {
    from {
        opacity: 0;
        transform: translateY(-15px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 氣泡尖角 - 手機版指向下方 */
.bubble-tail {
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border: 12px solid transparent;
    border-top-color: white;
    border-bottom: 0;
}

/* 桌面版：尖角指向左邊（Q北的方向） */
@media (min-width: 768px) {
    .bubble-tail {
        bottom: 30px;
        left: -10px;
        transform: none;
        border: 10px solid transparent;
        border-right-color: white;
        border-left: 0;
    }
}

/* 主標題 - 大字書法 */
.verdict-text {
    font-family: 'Yuji Syuku', serif;
    font-size: 1.8rem;
    color: #1c1917;
    line-height: 1.3;
    margin-bottom: 0.3rem;
}

@media (min-width: 768px) {
    .verdict-text {
        font-size: 2.2rem;
    }
}

/* 副標題 - Q北口吻 */
.verdict-subtext {
    font-family: 'Yuji Syuku', serif;
    font-size: 0.9rem;
    color: #57534e;
    line-height: 1.5;
    margin-bottom: 1rem;
}

/* 查看按鈕 */
.verdict-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    background: linear-gradient(135deg, #8B0000 0%, #6B0000 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: 'Yuji Syuku', serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(139, 0, 0, 0.3);
}

.verdict-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(139, 0, 0, 0.4);
}

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

/* 首次練習引導的雙按鈕 */
.verdict-btn-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.verdict-btn-primary {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    font-size: 1rem;
    padding: 0.8rem 1.5rem;
}

.verdict-btn-primary:hover {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
}

.verdict-btn-secondary {
    background: transparent;
    border: 1px solid rgba(139, 0, 0, 0.3);
    color: #8B0000;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    box-shadow: none;
}

.verdict-btn-secondary:hover {
    background: rgba(139, 0, 0, 0.05);
    box-shadow: none;
}

/* 首次練習引導（二階段版本） */
.first-practice-guide {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    text-align: center;
    min-height: 300px;
}

.guide-avatar {
    width: 180px;
    height: 180px;
    margin-bottom: 1.5rem;
}

.guide-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.2));
}

.guide-bubble {
    background: white;
    border-radius: 16px;
    padding: 1.5rem 2rem;
    max-width: 380px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.guide-title {
    font-family: 'Yuji Syuku', serif;
    font-size: 1.3rem;
    color: #1c1917;
    margin-bottom: 0.75rem;
}

.guide-message {
    font-size: 0.95rem;
    line-height: 1.7;
    color: #57534e;
    margin-bottom: 1.25rem;
}

.guide-btn-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.guide-btn {
    display: block;
    width: 100%;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-family: 'Yuji Syuku', serif;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.guide-btn-primary {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.guide-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.4);
}

.guide-btn-secondary {
    background: transparent;
    border: 1px solid rgba(139, 0, 0, 0.3);
    color: #8B0000;
}

.guide-btn-secondary:hover {
    background: rgba(139, 0, 0, 0.05);
}

/* 🟢 階段二：查看細節 */
.result-stage-details {
    animation: details-fade-in 0.5s ease-out;
}

@keyframes details-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 階段一淡出動畫 */
.result-stage-verdict.fade-out {
    animation: verdict-fade-out 0.4s ease-in forwards;
}

@keyframes verdict-fade-out {
    to {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
}

/* ========================================
   卷軸結構（複用主卷軸樣式）
   ======================================== */

.ninja-quiz-scroll .scroll-top {
    height: 16px;
    background: linear-gradient(180deg, #4a3728 0%, #2c241b 50%, #1a1512 100%);
    border-radius: 4px 4px 0 0;
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
}

.ninja-quiz-scroll .scroll-top::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent 0px,
        rgba(0, 0, 0, 0.1) 2px,
        transparent 4px
    );
    border-radius: 4px 4px 0 0;
}

.ninja-quiz-scroll .scroll-body {
    background: #fdfbf7;
    border-left: 3px solid #8B0000;
    border-right: 3px solid #8B0000;
    padding: 1.5rem 2rem 2rem;
    position: relative;
    min-height: 400px;
    box-shadow: 
        inset 0 0 30px rgba(139, 0, 0, 0.05),
        inset 0 0 10px rgba(0, 0, 0, 0.03),
        0 10px 40px rgba(0, 0, 0, 0.1),
        0 4px 12px rgba(0, 0, 0, 0.08);
}

.ninja-quiz-scroll .scroll-bottom {
    height: 16px;
    background: linear-gradient(180deg, #1a1512 0%, #2c241b 50%, #4a3728 100%);
    border-radius: 0 0 4px 4px;
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.3),
        inset 0 -1px 0 rgba(255, 255, 255, 0.1);
}

/* ========================================
   水墨進度條 (Ink Progress Bar)
   ======================================== */

.ink-progress {
    position: relative;
    height: 6px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.ink-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4a1c1c 0%, #8B0000 50%, #6B0000 100%);
    border-radius: 3px;
    transition: width 0.4s ease;
    position: relative;
}

/* 墨跡效果 */
.ink-progress-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 10px;
    height: 100%;
    background: linear-gradient(90deg, transparent, #8B0000);
    filter: blur(2px);
}

.ink-progress-meta {
    text-align: center;
    font-size: 0.85rem;
    color: #64748b;
    margin-top: 0.5rem;
    font-family: 'Yuji Syuku', serif;
}

/* ========================================
   題目區域 (The Challenge)
   ======================================== */

.challenge-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    position: relative;
}

/* 繪馬狀態顯示 */
.ema-indicator {
    position: absolute;
    top: 0;
    right: 0;
    width: 50px;
    height: 50px;
    opacity: 0.3;
    transition: all 0.3s ease;
}

.ema-indicator.active {
    opacity: 1;
}

.ema-indicator.silver {
    animation: ema-pulse 1.5s ease-in-out infinite;
}

.ema-indicator.pending {
    animation: ema-glow 1s ease-in-out infinite;
}

@keyframes ema-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes ema-glow {
    0%, 100% { filter: drop-shadow(0 0 5px rgba(234, 179, 8, 0.5)); }
    50% { filter: drop-shadow(0 0 15px rgba(234, 179, 8, 0.8)); }
}

.ema-indicator img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* 繪馬占位符（連對 0 次） */
.ema-placeholder {
    width: 100%;
    height: 100%;
    border: 2px dashed rgba(139, 0, 0, 0.2);
    border-radius: 8px;
    background: rgba(139, 0, 0, 0.03);
}

/* 題目假名 - 巨大書法字 */
.kana-challenge {
    font-family: 'Yuji Syuku', serif;
    font-size: 10rem;
    line-height: 1;
    color: #1c1917;
    text-align: center;
    margin: 1rem 0 2rem;
    position: relative;
    /* 墨水暈染效果 */
    text-shadow: 
        0 0 1px rgba(28, 25, 23, 0.8),
        0 2px 4px rgba(0, 0, 0, 0.1);
    /* 輕微的筆觸不規則感 */
    filter: url(#ink-texture);
}

/* 手機版縮小 */
@media (max-width: 640px) {
    .kana-challenge {
        font-size: 7rem;
    }
}

/* 答對時的發光效果 */
.kana-challenge.correct {
    animation: ink-correct 0.5s ease;
    color: #166534;
}

/* 答錯時的抖動 */
.kana-challenge.incorrect {
    animation: ink-incorrect 0.4s ease;
    color: #8B0000;
}

@keyframes ink-correct {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); text-shadow: 0 0 20px rgba(22, 101, 52, 0.5); }
    100% { transform: scale(1); }
}

@keyframes ink-incorrect {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

/* ========================================
   輸入框 - 毛筆底線風格
   ======================================== */

.brush-input-wrapper {
    width: 100%;
    max-width: 300px;
    margin: 0 auto 1.5rem;
    position: relative;
}

.brush-input {
    width: 100%;
    padding: 0.75rem 0.5rem;
    font-family: 'Caveat', cursive;
    font-size: 2rem;
    font-weight: 600;
    text-align: center;
    color: #1c1917;
    background: transparent;
    border: none;
    border-bottom: 4px solid #1c1917;
    outline: none;
    transition: border-color 0.3s ease;
}

.brush-input::placeholder {
    color: rgba(28, 25, 23, 0.3);
    font-weight: 400;
}

.brush-input:focus {
    border-bottom-color: #8B0000;
}

/* 底線墨跡效果 */
.brush-input-wrapper::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(28, 25, 23, 0.1) 20%,
        rgba(28, 25, 23, 0.1) 80%,
        transparent 100%
    );
    pointer-events: none;
}

/* ========================================
   提交按鈕 - 印章風格
   ======================================== */

.stamp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #8B0000 0%, #6B0000 100%);
    color: #fff;
    border: 3px solid #5a0000;
    border-radius: 8px;
    font-family: 'Yuji Syuku', serif;
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    box-shadow: 
        0 4px 12px rgba(139, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.stamp-btn:hover {
    transform: scale(1.05);
    box-shadow: 
        0 6px 16px rgba(139, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.stamp-btn:active {
    transform: scale(0.95) rotate(-2deg);
}

/* 印章邊框效果 */
.stamp-btn::before {
    content: '';
    position: absolute;
    inset: 4px;
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    pointer-events: none;
}

/* ========================================
   連擊顯示 (Combo Display)
   ======================================== */

.ninja-combo {
    position: absolute;
    top: 1rem;
    left: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ninja-combo.active {
    opacity: 1;
}

.combo-flame {
    font-size: 1.5rem;
    transition: all 0.3s ease;
}

.combo-count {
    font-family: 'Yuji Syuku', serif;
    font-size: 1.2rem;
    font-weight: bold;
    color: #8B0000;
}

/* 連擊等級 */
.ninja-combo.lv1 .combo-flame {
    animation: flame-flicker 1s infinite alternate;
}

.ninja-combo.lv2 .combo-flame {
    font-size: 1.8rem;
    animation: flame-flicker 0.5s infinite alternate;
}

.ninja-combo.lv2 .combo-count {
    font-size: 1.4rem;
    color: #ff4500;
}

.ninja-combo.lv3 .combo-flame {
    font-size: 2.2rem;
    animation: flame-flicker 0.2s infinite alternate;
    filter: drop-shadow(0 0 10px orange);
}

.ninja-combo.lv3 .combo-count {
    font-size: 1.6rem;
    color: #ff0000;
    text-shadow: 0 0 5px rgba(255, 0, 0, 0.5);
}

@keyframes flame-flicker {
    0% { transform: scale(1) rotate(-3deg); }
    100% { transform: scale(1.1) rotate(3deg); }
}

/* ========================================
   結果提示
   ======================================== */

.result-hint {
    text-align: center;
    font-family: 'Yuji Syuku', serif;
    font-size: 1.2rem;
    min-height: 2rem;
    margin-top: 1rem;
}

.result-hint.correct {
    color: #166534;
}

.result-hint.incorrect {
    color: #8B0000;
}

/* ========================================
   練習中按鈕區
   ======================================== */

.quiz-back-btn {
    display: block;
    margin: 1.5rem auto 0;
    padding: 0.5rem 1.5rem;
    background: transparent;
    border: 1px solid rgba(139, 0, 0, 0.3);
    border-radius: 6px;
    color: #8B0000;
    font-family: 'Yuji Syuku', serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quiz-back-btn:hover {
    background: rgba(139, 0, 0, 0.05);
    border-color: #8B0000;
}

/* ========================================
   SVG 濾鏡 - 墨水紋理
   ======================================== */

/* 這個 SVG 需要在 HTML 中定義 */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
}

/* ========================================
   深色模式
   ======================================== */

[data-theme="dark"] .ninja-quiz-scroll .scroll-body {
    background: #2a2520;
}

[data-theme="dark"] .kana-challenge {
    color: #fdfbf7;
    text-shadow: 
        0 0 1px rgba(253, 251, 247, 0.8),
        0 2px 4px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .brush-input {
    color: #fdfbf7;
    border-bottom-color: #fdfbf7;
}

[data-theme="dark"] .brush-input::placeholder {
    color: rgba(253, 251, 247, 0.3);
}

[data-theme="dark"] .brush-input:focus {
    border-bottom-color: #ef4444;
}

[data-theme="dark"] .ink-progress-meta {
    color: #94a3b8;
}

[data-theme="dark"] .quiz-back-btn {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

[data-theme="dark"] .quiz-back-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
}

/* ========================================
   結算畫面樣式
   ======================================== */

/* 結算卷軸中的 dashboard 永遠顯示 */
#result-scroll .result-dashboard {
    display: block;
    padding: 0;
    margin: 0;
    background: transparent;
    box-shadow: none;
}

/* 結算卷軸標題 */
#result-scroll .mission-title {
    text-align: center;
    margin-bottom: 0.5rem;
}

/* 結算分數 */
#result-scroll .result-score {
    text-align: center;
    font-family: 'Yuji Syuku', serif;
    font-size: 1.3rem;
    color: #8B0000;
    margin-bottom: 1rem;
}

/* 錯題區域 */
#result-scroll .result-wrong {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px dashed rgba(139, 0, 0, 0.2);
}

#result-scroll .result-wrong h3 {
    font-family: 'Yuji Syuku', serif;
    font-size: 1.1rem;
    color: #1c1917;
    margin-bottom: 0.5rem;
}

#result-scroll .result-wrong .wrong-hint {
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 1rem;
}

#result-scroll .wrong-empty {
    display: block;
    text-align: center;
    color: #64748b;
    font-size: 0.9rem;
    padding: 1rem;
}

/* 結算網格 */
.ninja-result-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
}

/* 寬版卷軸下，四格橫排 */
@media (min-width: 768px) {
    .result-scroll-wide .ninja-result-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.25rem;
    }
}

.ninja-result-grid .result-card {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(139, 0, 0, 0.2);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.ninja-result-grid .result-label {
    font-family: 'Yuji Syuku', serif;
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.ninja-result-grid .result-value {
    font-family: 'Yuji Syuku', serif;
    font-size: 1.5rem;
    font-weight: bold;
    color: #1c1917;
}

/* 結算按鈕區 */
.result-actions-ninja {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.result-actions-ninja .ninja-start-btn {
    width: 100%;
}

.result-actions-ninja .quiz-back-btn {
    margin: 0;
}

/* Q北結算對話 - 右下角浮動版 */
.qbei-result-float {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    animation: qbei-slide-in 0.4s ease-out;
}

@keyframes qbei-slide-in {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.qbei-result-float .qbei-avatar {
    width: 140px;
    height: 140px;
    flex-shrink: 0;
}

.qbei-result-float .qbei-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.2));
}

.qbei-result-float .qbei-bubble {
    background: white;
    border-radius: 16px;
    padding: 1rem 1.25rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    position: relative;
    max-width: 280px;
}

.qbei-result-float .qbei-bubble::after {
    content: '';
    position: absolute;
    bottom: 20px;
    right: -8px;
    width: 0;
    height: 0;
    border: 8px solid transparent;
    border-left-color: white;
    border-right: 0;
}

.qbei-result-float .qbei-text {
    font-family: 'Yuji Syuku', serif;
    font-size: 1.1rem;
    line-height: 1.5;
    color: #1c1917;
    margin-bottom: 0.5rem;
}

.qbei-result-float .qbei-hint {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 0;
}

.qbei-result-float .shrine-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 0.75rem;
    padding: 0.4rem 0.8rem;
    background: linear-gradient(135deg, #eab308 0%, #ca8a04 100%);
    color: white;
    border-radius: 6px;
    font-family: 'Yuji Syuku', serif;
    font-size: 0.85rem;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.qbei-result-float .shrine-link:hover {
    transform: scale(1.05);
}

/* 手機版 Q北結算 */
@media (max-width: 767px) {
    .qbei-result-float {
        bottom: 10px;
        right: 10px;
        left: 10px;
        flex-direction: column-reverse;
        align-items: center;
    }
    
    .qbei-result-float .qbei-avatar {
        width: 80px;
        height: 80px;
    }
    
    .qbei-result-float .qbei-bubble {
        max-width: none;
        width: 100%;
    }
    
    .qbei-result-float .qbei-bubble::after {
        display: none;
    }
}

/* 繪馬進度提示（Q北破框對話版） */
.ema-progress-notice {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 1.5rem 0;
    padding: 1rem;
}

/* 桌面版：橫向佈局 */
@media (min-width: 768px) {
    .ema-progress-notice {
        flex-direction: row;
        align-items: flex-end;
        justify-content: center;
    }
}

/* Q北自由站立 - 和階段一相同大小 */
.ema-notice-hero {
    width: 200px;
    height: 200px;
    z-index: 10;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .ema-notice-hero {
        width: 240px;
        height: 240px;
    }
}

.ema-notice-hero img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
}

/* 浮動對話氣泡 */
.ema-notice-bubble {
    position: relative;
    z-index: 20;
    background: white;
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    text-align: center;
    max-width: 300px;
    overflow: hidden;
    
    /* 手機版：氣泡在上方 */
    order: -1;
    margin-bottom: -40px;
}

@media (min-width: 768px) {
    .ema-notice-bubble {
        order: 0;
        margin-bottom: 0;
        margin-left: -50px;
        margin-bottom: 40px;
        text-align: left;
    }
}

/* 氣泡尖角 */
.ema-notice-bubble .bubble-tail {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border: 10px solid transparent;
    border-top-color: white;
    border-bottom: 0;
}

@media (min-width: 768px) {
    .ema-notice-bubble .bubble-tail {
        bottom: 20px;
        left: -8px;
        transform: none;
        border: 8px solid transparent;
        border-right-color: white;
        border-left: 0;
    }
}

.ema-notice-text {
    font-family: 'Yuji Syuku', serif;
    font-size: 1.5rem;
    color: #1c1917;
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

@media (min-width: 768px) {
    .ema-notice-text {
        font-size: 1.8rem;
    }
}

.ema-notice-text .highlight {
    color: #b45309;
    font-weight: 500;
}

.ema-notice-hint {
    font-family: 'Yuji Syuku', serif;
    font-size: 0.9rem;
    color: #57534e;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.ema-notice-btn {
    display: inline-block;
    padding: 0.4rem 0.9rem;
    background: linear-gradient(135deg, #eab308 0%, #ca8a04 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-family: 'Yuji Syuku', serif;
    font-size: 0.85rem;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.2s ease;
    box-shadow: 0 2px 6px rgba(234, 179, 8, 0.3);
}

.ema-notice-btn:hover {
    transform: scale(1.05);
}

/* 深色模式 */
[data-theme="dark"] .ema-notice-bubble {
    background: #2a2520;
}

[data-theme="dark"] .ema-notice-bubble .bubble-tail {
    border-top-color: #2a2520;
}

@media (min-width: 768px) {
    [data-theme="dark"] .ema-notice-bubble .bubble-tail {
        border-top-color: transparent;
        border-right-color: #2a2520;
    }
}

[data-theme="dark"] .ema-notice-text {
    color: #fdfbf7;
}

[data-theme="dark"] .ema-notice-text .highlight {
    color: #fbbf24;
}

/* 🥈 銀色晉升慶祝特效 */
.ema-progress-notice[data-type="silver"] .ema-notice-bubble {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 2px solid #94a3b8;
    box-shadow: 
        0 4px 16px rgba(148, 163, 184, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.ema-progress-notice[data-type="silver"] .ema-notice-text {
    background: linear-gradient(135deg, #475569 0%, #64748b 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 600;
}

/* 銀色慶祝動畫 */
.ema-progress-notice.silver-celebration .ema-notice-bubble {
    animation: silver-shine 1s ease-out;
}

@keyframes silver-shine {
    0% {
        box-shadow: 
            0 4px 16px rgba(148, 163, 184, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.8);
    }
    50% {
        box-shadow: 
            0 0 30px rgba(148, 163, 184, 0.6),
            0 0 60px rgba(203, 213, 225, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.8);
    }
    100% {
        box-shadow: 
            0 4px 16px rgba(148, 163, 184, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.8);
    }
}

/* 銀色氣泡掃光效果 */
.ema-progress-notice[data-type="silver"] .ema-notice-bubble::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    transform: skewX(-20deg);
    animation: silver-sheen 2s ease-in-out infinite;
}

@keyframes silver-sheen {
    0% { left: -100%; }
    100% { left: 200%; }
}

/* Q北 銀色晉升時的彈跳 */
.ema-progress-notice.silver-celebration .ema-notice-hero {
    animation: silver-bounce 0.6s ease-out;
}

@keyframes silver-bounce {
    0% { transform: scale(1); }
    30% { transform: scale(1.15); }
    50% { transform: scale(0.95); }
    70% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* 🥇 開光提示特效 */
.ema-progress-notice[data-type="kaigen"] .ema-notice-bubble {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 2px solid #f59e0b;
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3);
}

.ema-progress-notice[data-type="kaigen"] .ema-notice-text {
    color: #b45309;
    font-weight: 600;
}

/* 神社引導區 */
.shrine-guide-inline {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-radius: 8px;
    margin-top: 1rem;
}

.shrine-guide-inline .shrine-icon {
    font-size: 2rem;
}

.shrine-guide-inline .shrine-content {
    flex: 1;
}

.shrine-guide-inline .shrine-title {
    font-family: 'Yuji Syuku', serif;
    font-size: 1rem;
    color: #92400e;
    margin-bottom: 0.25rem;
}

.shrine-guide-inline .shrine-kana {
    font-size: 1.2rem;
    color: #1c1917;
    margin-bottom: 0.25rem;
}

.shrine-guide-inline .shrine-desc {
    font-size: 0.8rem;
    color: #64748b;
}

.shrine-guide-inline .shrine-btn {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #eab308 0%, #ca8a04 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-family: 'Yuji Syuku', serif;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.shrine-guide-inline .shrine-btn:hover {
    transform: scale(1.05);
}

/* 深色模式結算 */
[data-theme="dark"] .ninja-result-grid .result-card {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(139, 0, 0, 0.3);
}

[data-theme="dark"] .ninja-result-grid .result-value {
    color: #fdfbf7;
}

[data-theme="dark"] .qbei-result-area {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(139, 0, 0, 0.3);
}

[data-theme="dark"] .qbei-result-area .qbei-text {
    color: #fdfbf7;
}

[data-theme="dark"] .shrine-guide-inline {
    background: rgba(234, 179, 8, 0.1);
    border-color: rgba(234, 179, 8, 0.2);
}

/* ========================================
   練習獎勵（賽錢）
   ======================================== */

.practice-reward-notice {
    background: linear-gradient(135deg, #fff8e1, #ffecb3);
    border: 3px solid #3e2723;
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin: 1.5rem auto;
    max-width: 280px;
    box-shadow: 
        0 4px 12px rgba(62, 39, 35, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    animation: reward-bounce 0.6s ease-out;
}

@keyframes reward-bounce {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    50% {
        transform: scale(1.05) translateY(-5px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.reward-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.reward-coin-icon {
    width: 48px;
    height: 48px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    animation: coin-spin 1s ease-out;
}

@keyframes coin-spin {
    0% {
        transform: rotateY(0deg);
    }
    100% {
        transform: rotateY(720deg);
    }
}

.reward-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.reward-label {
    font-size: 0.85rem;
    color: #78716c;
    font-weight: 500;
}

.reward-amount {
    font-size: 1.8rem;
    font-weight: bold;
    color: #d97706;
    font-family: 'Yuji Syuku', serif;
    text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.5);
}

.reward-unit {
    font-size: 0.9rem;
    color: #3e2723;
    font-weight: 500;
}

/* 深色模式 */
[data-theme="dark"] .practice-reward-notice {
    background: linear-gradient(135deg, #3d3d3d, #2d2d2d);
    border-color: #d97706;
}

[data-theme="dark"] .reward-label {
    color: #a1a1aa;
}

[data-theme="dark"] .reward-amount {
    color: #fbbf24;
}

[data-theme="dark"] .reward-unit {
    color: #e5e5e5;
}
