/* =================================================================
   おかねのけいさん（kids-okane）専用スタイル
   すべて #app-kids-okane 配下にスコープ
   ================================================================= */

#app-kids-okane {
    /* おかねの穴・トレイ背景などテーマ連動の変数 */
    --ok-hole: var(--bs-body-bg);
    --ok-stage-bg: var(--bs-tertiary-bg);
}

/* ---------- せいせき・ミュート ---------- */
#app-kids-okane .ok-record {
    font-size: 1.05rem;
}

#app-kids-okane .ok-stat {
    white-space: nowrap;
    background: var(--ok-stage-bg);
    border-radius: 999px;
    padding: 0.15rem 0.7rem;
    font-size: 0.9rem;
}

@media (max-width: 576px) {
    #app-kids-okane .ok-stat {
        font-size: 0.8rem;
        padding: 0.1rem 0.5rem;
    }
}

/* ---------- モードえらびカード ---------- */
#app-kids-okane .ok-mode-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    height: 100%;
    padding: 1.5rem 1rem;
    border: 3px solid var(--bs-warning);
    border-radius: 1.25rem;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    min-height: 160px;
    justify-content: center;
}

#app-kids-okane .ok-mode-card:focus-visible {
    transform: translateY(-4px);
    box-shadow: 0 0.6rem 1.2rem rgba(0, 0, 0, 0.18);
    outline: none;
}

@media (hover: hover) { #app-kids-okane .ok-mode-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 0.6rem 1.2rem rgba(0, 0, 0, 0.18);
    outline: none;
} }

#app-kids-okane .ok-mode-card:active {
    transform: translateY(0);
}

#app-kids-okane .ok-mode-emoji {
    font-size: 3rem;
    line-height: 1.25;
}

#app-kids-okane .ok-mode-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
}

/* タイトルは 6〜9文字で 1行/2行に 割れ、サブも 13〜16文字で 割れる。
   2行ぶんを 予約して、どの カードでも おなじ 位置に 出す（h-100 と セット） */
#app-kids-okane .ok-mode-title {
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1.3;
    min-height: calc(1.3rem * 1.3 * 2);
    display: flex;
    align-items: center;
}

#app-kids-okane .ok-mode-sub {
    font-size: 0.9rem;
    color: var(--bs-secondary-color);
    line-height: 1.35;
    min-height: calc(0.9rem * 1.35 * 2);
}

/* ---------- おかね（硬貨・紙幣）共通 ---------- */
#app-kids-okane .okane {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    line-height: 1;
    user-select: none;
    box-sizing: border-box;
    flex: 0 0 auto;
}

/* 硬貨（円） */
#app-kids-okane .coin {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    color: #4a3b12;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3), inset 0 0 0 2px rgba(255, 255, 255, 0.25);
}

#app-kids-okane .okane-face {
    font-size: 1.05rem;
}

#app-kids-okane .okane-unit {
    font-size: 0.55rem;
    opacity: 0.85;
}

/* 銀色系（1・50・100） */
#app-kids-okane .coin--1,
#app-kids-okane .coin--50,
#app-kids-okane .coin--100 {
    background: radial-gradient(circle at 35% 30%, #ffffff, #d9dde0 45%, #a7adb2 100%);
    color: #444a4f;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
    border: 2px solid #9aa0a5;
}

/* 金色系（5） */
#app-kids-okane .coin--5 {
    background: radial-gradient(circle at 35% 30%, #fff6cf, #f0d97a 45%, #c9a227 100%);
    color: #6b5311;
    border: 2px solid #c0982a;
}

/* 銅色（10） */
#app-kids-okane .coin--10 {
    background: radial-gradient(circle at 35% 30%, #f3c8a0, #d98a5a 45%, #a0522d 100%);
    color: #ffffff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
    border: 2px solid #8a4526;
}

/* 500円（金銀・二色っぽく・いちばん大きい） */
#app-kids-okane .coin--500 {
    width: 66px;
    height: 66px;
    background: radial-gradient(circle at 35% 30%, #fdf0c0, #e8cf86 40%, #b7b7bb 100%);
    color: #5a4a1a;
    border: 2px solid #b09a55;
}

/* 1円はすこし小さめ */
#app-kids-okane .coin--1 {
    width: 50px;
    height: 50px;
}

/* あなあき（5・50） */
#app-kids-okane .coin.has-hole .coin-hole {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 26%;
    height: 26%;
    border-radius: 50%;
    background: var(--ok-hole);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.55);
}

/* あなの 上下に 数字と「円」を 逃がす。あなは 中央 26%（29px の 硬貨で 上端 37%・下端 63%）
   なので、数字は 上から 7%〜約32%、「円」は 下から 7%〜約22% に 収まる */
#app-kids-okane .coin.has-hole .okane-face {
    position: absolute;
    top: 7%;
    font-size: 0.9rem;
}

#app-kids-okane .coin.has-hole .okane-unit {
    position: absolute;
    bottom: 7%;
}

/* 1000円札（よこなが矩形） */
#app-kids-okane .bill--1000 {
    width: 96px;
    height: 56px;
    border-radius: 8px;
    flex-direction: row;
    gap: 3px;
    background: linear-gradient(135deg, #cfe3d6, #a7c9b4 55%, #86b39a 100%);
    color: #234a38;
    border: 2px solid #6ea084;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3), inset 0 0 0 3px rgba(255, 255, 255, 0.35);
}

#app-kids-okane .bill--1000 .okane-face {
    font-size: 1.3rem;
}

#app-kids-okane .bill--1000 .okane-unit {
    font-size: 0.8rem;
    align-self: flex-end;
    padding-bottom: 4px;
}

/* タップできる おかね */
#app-kids-okane .okane.is-tappable {
    cursor: pointer;
    transition: transform 0.1s ease, filter 0.1s ease;
}

#app-kids-okane .okane.is-tappable:focus-visible {
    transform: scale(1.08);
    filter: brightness(1.05);
    outline: 3px solid var(--bs-primary);
    outline-offset: 2px;
}

@media (hover: hover) { #app-kids-okane .okane.is-tappable:hover {
    transform: scale(1.08);
    filter: brightness(1.05);
    outline: 3px solid var(--bs-primary);
    outline-offset: 2px;
} }

#app-kids-okane .okane.is-tappable:active {
    transform: scale(0.96);
}

/* だすときの ぽんっ アニメ */
@keyframes ok-pop-in {
    0% { transform: scale(0.2); opacity: 0; }
    70% { transform: scale(1.12); }
    100% { transform: scale(1); opacity: 1; }
}

#app-kids-okane .okane.is-pop {
    animation: ok-pop-in 0.25s ease;
}

/* ---------- おかね ステージ（いくらかな？） ---------- */
#app-kids-okane .ok-money-stage {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-items: center;
    min-height: 96px;
    padding: 0.75rem;
    background: var(--ok-stage-bg);
    border-radius: 1rem;
}

/* ---------- こたえ表示（テンキー入力） ---------- */
#app-kids-okane .ok-answer-display {
    text-align: center;
    background: var(--ok-stage-bg);
    border-radius: 0.75rem;
    padding: 0.5rem 1rem;
    font-weight: 800;
}

#app-kids-okane .ok-answer-number {
    font-size: 2rem;
    color: var(--kids-accent-text, var(--bs-primary));
}

#app-kids-okane .ok-answer-unit {
    font-size: 1.15rem;
    color: var(--bs-secondary-color);
    margin-left: 0.2rem;
}

/* ---------- テンキー ---------- */
#app-kids-okane .ok-tenkey {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    max-width: 320px;
    margin: 0 auto;
}

#app-kids-okane .ok-key {
    min-height: 48px;
    font-size: 1.35rem;
    font-weight: 800;
    border-radius: 0.75rem;
}

/* ---------- しょうひん ---------- */
/* 絵文字を 左、名前と ねだんを 右に 置く。たてに 積むと 172px 使い、
   あそぶ ところが 画面の 外へ 押し出される（2026-09-01 実測） */
#app-kids-okane .ok-product {
    display: grid;
    grid-template-columns: auto auto;
    align-items: center;
    justify-content: center;
    column-gap: 0.75rem;
    text-align: left;
}

#app-kids-okane .ok-product-emoji {
    grid-row: 1 / 3;
    font-size: 3rem;
    line-height: 1.15;
    display: block;
}

#app-kids-okane .ok-product-name {
    grid-column: 2;
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.25;
}

#app-kids-okane .ok-product-price {
    grid-column: 2;
    font-size: 1.7rem;
    font-weight: 800;
    line-height: 1.2;
    color: var(--bs-danger);
}

/* 説明文は 全幅で 下に まわす */
#app-kids-okane .ok-product > p {
    grid-column: 1 / -1;
    text-align: center;
    margin-top: 0.15rem;
}

/* ---------- トレイ・おさいふ ---------- */
#app-kids-okane .ok-tray-wrap {
    border: 2px dashed var(--bs-border-color);
    border-radius: 1rem;
    padding: 0.75rem;
    background: var(--ok-stage-bg);
}

#app-kids-okane .ok-tray-label,
#app-kids-okane .ok-wallet-label {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    color: var(--bs-secondary-color);
}

#app-kids-okane .ok-tray {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 56px;
    align-items: center;
    justify-content: center;
}

#app-kids-okane .ok-tray-empty {
    color: var(--bs-secondary-color);
    font-size: 0.9rem;
}

#app-kids-okane .ok-tray-total {
    text-align: right;
    font-weight: 800;
    font-size: 1.15rem;
    margin-top: 0.25rem;
    white-space: nowrap;
    color: var(--kids-accent-text, var(--bs-primary));
}

/* 6金種を 3れつ×2ぎょうで そろえる。flex の 折り返しだと 4+2 に 割れて 見つけにくい */
#app-kids-okane .ok-wallet {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    justify-items: center;
    align-items: center;
    padding: 0.6rem;
    background: var(--ok-stage-bg);
    border-radius: 1rem;
}

/* おさいふの各金種（ラベル付き） */
#app-kids-okane .ok-wallet-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

#app-kids-okane .ok-wallet-item .ok-wallet-name {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--bs-secondary-color);
}

/* ---------- フィードバック ---------- */
#app-kids-okane .ok-feedback {
    text-align: center;
    font-weight: 800;
    font-size: 1.15rem;
    min-height: 1.6rem;
}

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

#app-kids-okane .ok-feedback.is-wrong {
    color: var(--bs-warning);
}

/* 1行解説（フィードバック内の副文） */
#app-kids-okane .ok-explain {
    text-align: center; /* 演出は画面の中央に出す */
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--bs-secondary-color);
    margin-top: 0.3rem;
}

/* ---------- かえるかな？ の 2択ボタン ---------- */
#app-kids-okane .ok-choice {
    min-width: 140px;
}

/* ---------- おつりは いくら？ ---------- */
/* お札と とい を よこに ならべる（たてに 積むと テンキーが 画面の 外へ 出る） */
#app-kids-okane .ok-change-line {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ---------- べつのくみあわせ の おてほん ---------- */
#app-kids-okane .ok-combo-sample-wrap .ok-tray-label {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
    color: var(--bs-secondary-color);
}

#app-kids-okane .ok-sample-stage {
    min-height: 68px;
    opacity: 0.95;
    border: 2px solid var(--bs-border-color);
}

/* ---------- モバイル調整 ---------- */
@media (max-width: 576px) {
    #app-kids-okane .ok-mode-card {
        min-height: 130px;
        padding: 1.1rem 0.75rem;
    }

    #app-kids-okane .ok-mode-emoji {
        font-size: 2.4rem;
    }

    #app-kids-okane .ok-answer-number {
        font-size: 2rem;
    }

    #app-kids-okane .ok-money-stage {
        gap: 8px;
        padding: 0.75rem;
    }
}

/* アニメーションを控えたい利用者へ配慮 */
@media (prefers-reduced-motion: reduce) {
    #app-kids-okane .okane.is-pop,
    #app-kids-okane .ok-mode-card {
        animation: none !important;
        transition: none !important;
    }
}

/* 402x703（iPhone 17 Pro）で「かいけいする」が画面外に出ていたので余白を詰める（2026-08-07 実測） */
@media (max-width: 575.98px) {
    #app-kids-okane .ok-panel { padding: 0.35rem; }
    #app-kids-okane .ok-tray-wrap, #app-kids-okane .ok-wallet { padding: 0.5rem; }
    #app-kids-okane .ok-panel > .card > .card-body { padding: 0.4rem; }
    #app-kids-okane .ok-product { margin-bottom: 0.5rem; }
    #app-kids-okane .ok-wallet-label { margin-top: 0.5rem; }
    #app-kids-okane .ok-feedback { margin-top: 0.5rem; }
}
