/* =================================================================
 * おはなしの記憶（お話の記憶）固有スタイル
 * すべてのセレクタを #app-kids-ohanashi でスコープ
 * ================================================================= */

#app-kids-ohanashi {
    --oh-accent: #6f5bd8;
}

/* ---------- がんばりきろく ---------- */
#app-kids-ohanashi .oh-record-box {
    background: var(--bs-body-bg);
    border: 2px solid var(--bs-border-color);
    border-radius: 1rem;
    padding: 0.75rem 0.4rem;
}

#app-kids-ohanashi .oh-record-num {
    font-size: 1.7rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--bs-body-color);
}

/* ---------- しんちょくバー ---------- */
#app-kids-ohanashi .oh-progress {
    border-radius: 0;
}

#app-kids-ohanashi .oh-progress .progress-bar {
    transition: width 0.35s ease;
}

/* ---------- よみあげフェーズ ---------- */
#app-kids-ohanashi .oh-scene {
    font-size: clamp(4rem, 22vw, 7rem);
    line-height: 1.1;
    margin: 0.5rem 0 1rem;
    animation: oh-bob 2.2s ease-in-out infinite;
}

@keyframes oh-bob {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.06); }
}

/* えもじが切り替わる瞬間のポップ */
#app-kids-ohanashi .oh-scene.is-change {
    animation: oh-scene-pop 0.4s ease;
}

@keyframes oh-scene-pop {
    0% { transform: scale(0.6); opacity: 0.3; }
    60% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* よみあげ中インジケーター（3つの点） */
#app-kids-ohanashi .oh-reading-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--bs-info-text-emphasis, var(--bs-info));
    min-height: 1.8rem;
}

#app-kids-ohanashi .oh-reading-indicator.is-done {
    visibility: hidden;
}

#app-kids-ohanashi .oh-dot {
    width: 0.55rem;
    height: 0.55rem;
    margin: 0 0.12rem;
    border-radius: 50%;
    background: var(--bs-info);
    display: inline-block;
    animation: oh-dot 1.2s ease-in-out infinite;
}

#app-kids-ohanashi .oh-dot:nth-child(2) { animation-delay: 0.2s; }
#app-kids-ohanashi .oh-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes oh-dot {
    0%, 100% { transform: translateY(0); opacity: 0.4; }
    50% { transform: translateY(-6px); opacity: 1; }
}

/* もじ表示エリア */
#app-kids-ohanashi .oh-text {
    text-align: left;
    max-width: 34rem;
    margin: 0 auto 0.5rem;
    padding: 1rem 1.2rem;
    background: var(--bs-body-tertiary-bg, var(--bs-tertiary-bg));
    border: 2px solid var(--bs-border-color);
    border-radius: 1rem;
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.9;
    color: var(--bs-body-color);
}

#app-kids-ohanashi .oh-text p {
    margin: 0 0 0.4rem;
}

#app-kids-ohanashi .oh-text p:last-child {
    margin-bottom: 0;
}

#app-kids-ohanashi .oh-text p.is-now {
    color: var(--oh-accent);
    font-weight: 800;
}

/* ---------- しつもんフェーズ ---------- */
#app-kids-ohanashi .oh-question {
    font-size: clamp(1.2rem, 5vw, 1.6rem);
    font-weight: 800;
    line-height: 1.4;
    color: var(--bs-body-color);
    min-height: 2.4rem;
}

/* 4択 */
#app-kids-ohanashi .oh-choices {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
    max-width: 32rem;
    margin: 0 auto 0.5rem;
}

#app-kids-ohanashi .oh-choice {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    min-height: 4.6rem;
    padding: 0.7rem 0.5rem;
    font-size: 1.25rem;
    font-weight: 800;
    border: 3px solid var(--bs-border-color);
    border-radius: 1rem;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    cursor: pointer;
    transition: transform 0.06s ease, border-color 0.15s ease, background 0.15s ease;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.1);
}

#app-kids-ohanashi .oh-choice .oh-choice-emoji {
    font-size: 1.8rem;
    line-height: 1.25;
}

#app-kids-ohanashi .oh-choice:active {
    transform: translateY(2px);
    box-shadow: none;
}

@media (hover: hover) { #app-kids-ohanashi .oh-choice:hover:not(:disabled) {
    border-color: var(--oh-accent);
} }

#app-kids-ohanashi .oh-choice.is-correct {
    border-color: var(--bs-success);
    background: rgba(var(--bs-success-rgb), 0.15);
    color: var(--bs-success);
}

#app-kids-ohanashi .oh-choice.is-wrong {
    border-color: var(--bs-danger);
    background: rgba(220, 53, 69, 0.13);
    color: var(--bs-danger);
}

#app-kids-ohanashi .oh-choice:disabled {
    cursor: default;
    opacity: 1;
}

/* ---------- 並べ替え（順番問題） ---------- */
#app-kids-ohanashi .oh-order-slots {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    min-height: 4.4rem;
    padding: 0.5rem;
    border: 2px dashed var(--bs-border-color);
    border-radius: 1rem;
}

#app-kids-ohanashi .oh-order-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 4.2rem;
    min-height: 4rem;
    padding: 0.3rem;
    border-radius: 0.8rem;
    background: var(--bs-body-tertiary-bg, var(--bs-tertiary-bg));
    border: 2px solid var(--bs-border-color);
    position: relative;
}

#app-kids-ohanashi .oh-order-slot .oh-slot-badge {
    position: absolute;
    top: -0.5rem;
    left: -0.5rem;
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 50%;
    background: var(--oh-accent);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

#app-kids-ohanashi .oh-order-pool {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    min-height: 4.4rem;
}

#app-kids-ohanashi .oh-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    width: 4.6rem;
    min-height: 4.2rem;
    padding: 0.4rem 0.3rem;
    border: 3px solid var(--bs-border-color);
    border-radius: 0.9rem;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
    transition: transform 0.06s ease, border-color 0.15s ease;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.1);
}

#app-kids-ohanashi .oh-card .oh-card-emoji {
    font-size: 1.8rem;
    line-height: 1.25;
}

#app-kids-ohanashi .oh-card:active {
    transform: translateY(2px);
    box-shadow: none;
}

@media (hover: hover) { #app-kids-ohanashi .oh-card:hover {
    border-color: var(--oh-accent);
} }

#app-kids-ohanashi .oh-order-slot .oh-card {
    box-shadow: none;
    border-color: var(--oh-accent);
    cursor: default;
}

#app-kids-ohanashi .oh-order-slot.is-correct .oh-card {
    border-color: var(--bs-success);
    background: rgba(var(--bs-success-rgb), 0.13);
}

#app-kids-ohanashi .oh-order-slot.is-wrong .oh-card {
    border-color: var(--bs-danger);
    background: rgba(220, 53, 69, 0.12);
}

/* ---------- はんてい メッセージ ---------- */
#app-kids-ohanashi .oh-feedback {
    text-align: center; /* 演出は画面の中央に出す */
    min-height: 2.4rem;
    font-size: 1.4rem;
    font-weight: 800;
    margin: 0.8rem 0 0.4rem;
    line-height: 1.3;
}

#app-kids-ohanashi .oh-feedback.is-correct {
    color: var(--bs-success);
}

#app-kids-ohanashi .oh-feedback.is-wrong {
    color: var(--bs-danger);
}

#app-kids-ohanashi .oh-feedback .oh-fb-explain {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--bs-body-color);
    margin-top: 0.3rem;
}

/* ---------- アニメーション ---------- */
@keyframes oh-pop {
    0% { transform: scale(0.4); opacity: 0; }
    60% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

#app-kids-ohanashi .oh-feedback.is-animate {
    animation: oh-pop 0.4s ease;
}

/* ---------- けっか ---------- */
#app-kids-ohanashi .oh-result-emoji {
    font-size: clamp(3.5rem, 16vw, 5rem);
    line-height: 1.25;
    margin-bottom: 0.5rem;
    animation: oh-pop 0.5s ease;
}

#app-kids-ohanashi .oh-result-box {
    background: var(--bs-body-tertiary-bg, var(--bs-tertiary-bg));
    border: 2px solid var(--bs-border-color);
    border-radius: 1rem;
    padding: 0.9rem 0.5rem;
}

#app-kids-ohanashi .oh-result-num {
    font-size: 1.9rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--bs-body-color);
}

#app-kids-ohanashi .oh-result-marks {
    font-size: 1.5rem;
    letter-spacing: 0.12em;
    word-break: break-word;
}

/* ---------- モバイル微調整 ---------- */
@media (max-width: 575.98px) {
    #app-kids-ohanashi .oh-choices {
        gap: 0.5rem;
    }

    #app-kids-ohanashi .oh-choice {
        min-height: 4rem;
        font-size: 1.1rem;
    }

    #app-kids-ohanashi .oh-card,
    #app-kids-ohanashi .oh-order-slot {
        width: 4rem;
    }

    #app-kids-ohanashi .oh-record-num {
        font-size: 1.4rem;
    }
}
