/* =================================================================
 * きせつあわせ（kinder-season）ツール固有スタイル
 * すべて #app-kinder-season にスコープ。ライト/ダーク両対応。
 * ================================================================= */

#app-kinder-season {
    --ks-radius: 20px;
    -webkit-tap-highlight-color: transparent;
}

/* 画面切り替え */
#app-kinder-season .ks-screen {
    animation: ks-fade-in 0.25s ease;
}

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

/* ---------- 上部バー ---------- */
#app-kinder-season .ks-topbar {
    min-height: 52px;
}

#app-kinder-season .ks-sticker-box {
    display: inline-flex;
    align-items: baseline;
    gap: 0.3rem;
    padding: 0.45rem 1rem;
    border-radius: 999px;
    background: var(--bs-warning-bg-subtle);
    border: 2px solid var(--bs-warning-border-subtle);
    font-size: 1.15rem;
}

#app-kinder-season .ks-sticker-star { font-size: 1.35rem; }
#app-kinder-season .ks-sticker-label { font-size: 0.85rem; color: var(--bs-secondary-color); }

#app-kinder-season .ks-icon-btn {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    font-size: 1.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#app-kinder-season .ks-sound-off {
    opacity: 0.5;
}

/* ---------- ホーム: モードえらび ---------- */
#app-kinder-season .ks-mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    min-height: 150px;
    padding: 1.2rem 0.75rem;
    border: 3px solid var(--bs-border-color);
    border-radius: var(--ks-radius);
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
    cursor: pointer;
}

#app-kinder-season .ks-mode-btn:focus-visible {
    border-color: var(--bs-primary);
    box-shadow: 0 8px 20px rgba(124, 90, 195, 0.18);
    transform: translateY(-3px);
    outline: none;
}

@media (hover: hover) { #app-kinder-season .ks-mode-btn:hover {
    border-color: var(--bs-primary);
    box-shadow: 0 8px 20px rgba(124, 90, 195, 0.18);
    transform: translateY(-3px);
    outline: none;
} }

#app-kinder-season .ks-mode-btn:active {
    transform: scale(0.97);
}

#app-kinder-season .ks-mode-emoji { font-size: 2.8rem; line-height: 1.25; }
#app-kinder-season .ks-mode-title { font-weight: 800; font-size: clamp(0.95rem, 3.6vw, 1.15rem); }
#app-kinder-season .ks-mode-sub { font-size: 0.72rem; color: var(--bs-secondary-color); }

/* ---------- モード①: きせつずかん ---------- */
#app-kinder-season .ks-season-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
}

#app-kinder-season .ks-season-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.7rem 0.3rem;
    border: 3px solid var(--bs-border-color);
    border-radius: 16px;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    cursor: pointer;
    transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

#app-kinder-season .ks-season-tab:active { transform: scale(0.95); }
#app-kinder-season .ks-season-tab.active {
    border-color: var(--sc);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    background: color-mix(in srgb, var(--sc) 12%, var(--bs-body-bg));
}

#app-kinder-season .ks-season-tab-emoji { font-size: 1.9rem; line-height: 1.25; }
#app-kinder-season .ks-season-tab-name { font-weight: 800; font-size: 0.95rem; }

#app-kinder-season .ks-season-panel {
    border: 3px solid var(--sc, var(--bs-border-color));
    border-radius: var(--ks-radius);
    padding: 1rem;
    background: color-mix(in srgb, var(--sc, #999) 8%, var(--bs-body-bg));
}

#app-kinder-season .ks-season-head {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

#app-kinder-season .ks-season-head-emoji { font-size: 2rem; line-height: 1.25; }
#app-kinder-season .ks-season-head-name {
    font-size: clamp(1.5rem, 6vw, 2rem);
    font-weight: 900;
    color: var(--sc, var(--bs-primary));
}

#app-kinder-season .ks-item-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.6rem;
}

@media (min-width: 576px) {
    #app-kinder-season .ks-item-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

#app-kinder-season .ks-item-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0.6rem 0.2rem;
    border: 2px solid var(--bs-border-color);
    border-radius: 14px;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    cursor: pointer;
    transition: transform 0.12s ease;
    min-height: 82px;
}

#app-kinder-season .ks-item-card:active { transform: scale(0.93); }
#app-kinder-season .ks-item-emoji { font-size: 2rem; line-height: 1.25; }
#app-kinder-season .ks-item-name { font-weight: 700; font-size: 0.78rem; text-align: center; }

/* ---------- 出題パネル（モード②③共通） ---------- */
#app-kinder-season .ks-ask-panel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.6rem 1.3rem;
    /* 1行の 高さは 54px。**999px だと 2行に なった とたん たまご形に ふくらむ**
       （2026-09-04 実機で kinder/color に 指摘）。半分（27px）より すこし 大きい
       固定値に すれば、1行の ときは これまでどおり まるく、2行でも 形が くずれない */
    border-radius: 1.75rem;
    background: var(--bs-body-bg);
    border: 3px solid var(--bs-primary-border-subtle);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

#app-kinder-season .ks-ask-emoji { font-size: 1.8rem; line-height: 1.25; }
#app-kinder-season .ks-ask-name {
    font-size: clamp(1.6rem, 7vw, 2.2rem);
    font-weight: 900;
    color: var(--kids-accent-text, var(--bs-primary));
}
#app-kinder-season .ks-ask-label { font-size: 0.95rem; color: var(--bs-secondary-color); font-weight: 700; }

#app-kinder-season .ks-speak-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    padding: 0;
}

/* 進捗ドット */
#app-kinder-season .ks-progress-dots {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
}

#app-kinder-season .ks-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--bs-border-color);
    transition: transform 0.2s ease, background 0.2s ease;
}

#app-kinder-season .ks-dot.done { background: var(--bs-warning); }
#app-kinder-season .ks-dot.current { background: var(--bs-primary); transform: scale(1.3); }

/* ---------- モード②: 4択 ---------- */
#app-kinder-season .ks-choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

#app-kinder-season .ks-choice {
    /* width を 書かないと min-height から aspect-ratio が 幅を 逆算し、
       グリッドの わくを こえて 画面から はみ出す（2026-08-19 kinder/sounds で 実際に 発生）。
       390px では ぎりぎり 収まるが、375px の 画面では こえる */
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    aspect-ratio: 16 / 11;
    min-height: 110px;
    border-radius: var(--ks-radius);
    border: 3px solid var(--bs-border-color);
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.12s ease, border-color 0.12s ease;
    position: relative;
}

#app-kinder-season .ks-choice:active { transform: scale(0.95); }
#app-kinder-season .ks-choice-emoji { font-size: 2.6rem; line-height: 1.25; }
#app-kinder-season .ks-choice-name { font-weight: 800; font-size: 0.9rem; }
#app-kinder-season .ks-choice.ks-wrong { animation: ks-wobble 0.5s ease; }
#app-kinder-season .ks-choice.ks-correct {
    animation: ks-pop 0.5s ease;
    border-color: var(--bs-primary);
    z-index: 2;
}
#app-kinder-season .ks-choice.ks-dim { opacity: 0.35; filter: grayscale(0.4); }

/* ---------- モード③: なかまわけ ---------- */
#app-kinder-season .ks-remain {
    font-weight: 800;
    color: var(--bs-secondary-color);
    font-size: 0.95rem;
    min-height: 1.4em;
}

#app-kinder-season .ks-collect-field {
    position: relative;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.6rem;
    padding: 0.6rem;
    border-radius: var(--ks-radius);
    background: var(--bs-tertiary-bg);
    min-height: 260px;
}

@media (min-width: 576px) {
    #app-kinder-season .ks-collect-field { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

#app-kinder-season .ks-blob {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    aspect-ratio: 1 / 1;
    border-radius: 16px;
    border: 2px solid var(--bs-border-color);
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.3s ease;
    min-height: 64px;
}

#app-kinder-season .ks-blob:active { transform: scale(0.9); }
#app-kinder-season .ks-blob-emoji { font-size: 1.9rem; line-height: 1.25; }
#app-kinder-season .ks-blob-name { font-weight: 700; font-size: 0.66rem; text-align: center; }
#app-kinder-season .ks-blob.ks-got {
    animation: ks-pop 0.45s ease;
    opacity: 0;
    pointer-events: none;
    transform: scale(0);
}

#app-kinder-season .ks-blob.ks-miss { animation: ks-wobble 0.45s ease; }

/* ---------- 共通アニメーション ---------- */
@keyframes ks-pop {
    0% { transform: scale(1); }
    40% { transform: scale(1.22); }
    100% { transform: scale(1); }
}

@keyframes ks-wobble {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px) rotate(-3deg); }
    40% { transform: translateX(8px) rotate(3deg); }
    60% { transform: translateX(-6px) rotate(-2deg); }
    80% { transform: translateX(6px) rotate(2deg); }
}

/* ---------- せいかい演出オーバーレイ ---------- */
#app-kinder-season .ks-celebrate {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.05);
}

#app-kinder-season .ks-celebrate-inner {
    position: relative;
    text-align: center;
}

#app-kinder-season .ks-celebrate-char {
    font-size: clamp(4rem, 22vw, 8rem);
    animation: ks-bounce 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#app-kinder-season .ks-celebrate-text {
    font-size: clamp(1.8rem, 9vw, 3rem);
    font-weight: 900;
    color: #fff;
    -webkit-text-stroke: 2px var(--bs-primary);
    paint-order: stroke fill;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    animation: ks-pop 0.6s ease 0.1s both;
}

@keyframes ks-bounce {
    0% { transform: scale(0) rotate(-30deg); }
    60% { transform: scale(1.25) rotate(8deg); }
    100% { transform: scale(1) rotate(0); }
}

#app-kinder-season .ks-sparkles {
    position: absolute;
    inset: -40px;
    pointer-events: none;
}

#app-kinder-season .ks-spark {
    position: absolute;
    left: 50%;
    top: 50%;
    font-size: 1.6rem;
    animation: ks-spark-fly 0.9s ease-out forwards;
}

@keyframes ks-spark-fly {
    0% { transform: translate(-50%, -50%) scale(0.2); opacity: 1; }
    100% { transform: translate(var(--dx), var(--dy)) scale(1.1); opacity: 0; }
}

/* ---------- セットクリア（シールゲット） ---------- */
#app-kinder-season .ks-clear-overlay {
    position: fixed;
    inset: 0;
    z-index: 1085;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.45);
    animation: ks-fade-in 0.25s ease;
}

#app-kinder-season .ks-clear-card {
    background: var(--bs-body-bg);
    border-radius: 26px;
    padding: 2rem 1.5rem;
    text-align: center;
    max-width: 360px;
    width: 100%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    animation: ks-bounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#app-kinder-season .ks-clear-emoji { font-size: 4rem; line-height: 1.25; }
#app-kinder-season .ks-clear-title { font-size: 2rem; font-weight: 900; color: var(--kids-accent-text, var(--bs-primary)); margin-top: 0.3rem; }
#app-kinder-season .ks-clear-sub { color: var(--bs-secondary-color); font-weight: 700; }
#app-kinder-season .ks-clear-sticker { font-size: 3rem; margin: 0.6rem 0; animation: ks-pop 0.8s ease 0.3s both; }

/* ---------- content-seo: 季節バッジ ---------- */
#app-kinder-season .ks-season-badge {
    display: inline-block;
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    font-weight: 800;
    white-space: nowrap;
    background: color-mix(in srgb, var(--sc) 18%, transparent);
    border: 2px solid var(--sc);
}

/* ---------- むずかしさ（4段階セレクタ） ---------- */
#app-kinder-season .ks-level-wrap {
    text-align: center;
}

#app-kinder-season .ks-level-title {
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--bs-secondary-color);
    margin-bottom: 0.4rem;
}

#app-kinder-season .ks-level-bar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
    max-width: 460px;
    margin: 0 auto;
}

#app-kinder-season .ks-level-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.55rem 0.25rem;
    border: 3px solid var(--bs-border-color);
    border-radius: 14px;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    cursor: pointer;
    transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

#app-kinder-season .ks-level-btn:active { transform: scale(0.95); }
#app-kinder-season .ks-level-btn.active {
    border-color: var(--bs-primary);
    background: var(--bs-primary-bg-subtle);
}

#app-kinder-season .ks-level-stars {
    color: #f0b400;
    font-size: 0.95rem;
    letter-spacing: 1px;
    line-height: 1;
    min-height: 1em;
}
#app-kinder-season .ks-level-btn.active .ks-level-stars { color: #f5a623; }
#app-kinder-season .ks-level-age { font-weight: 700; font-size: 0.72rem; }

/* ---------- がんばりきろく ---------- */
#app-kinder-season .ks-records {
    margin-top: 1.5rem;
    padding: 0.9rem 1rem;
    border-radius: var(--ks-radius);
    background: var(--bs-tertiary-bg);
}

#app-kinder-season .ks-rec-title {
    text-align: center;
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--bs-secondary-color);
    margin-bottom: 0.6rem;
}

#app-kinder-season .ks-rec-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
}

#app-kinder-season .ks-rec-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    padding: 0.5rem 0.2rem;
    border-radius: 12px;
    background: var(--bs-body-bg);
}

#app-kinder-season .ks-rec-emoji { font-size: 1.5rem; line-height: 1.25; }
#app-kinder-season .ks-rec-val { font-weight: 900; font-size: 0.95rem; color: var(--kids-accent-text, var(--bs-primary)); }
#app-kinder-season .ks-rec-label { font-size: 0.68rem; color: var(--bs-secondary-color); font-weight: 700; }

/* ---------- モード②: せいかい解説（こども語1行） ---------- */
#app-kinder-season .ks-learn {
    margin: 1rem auto 0;
    max-width: 460px;
    text-align: center;
    padding: 0.6rem 1rem;
    border-radius: 14px;
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-body-color);
    border: 2px solid var(--bs-primary-border-subtle);
    font-weight: 800;
    font-size: 0.95rem;
    animation: ks-pop 0.4s ease;
}

/* ---------- モード④: きせつじゅんばん ---------- */
#app-kinder-season .ks-order-slots {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
    max-width: 560px;
    margin: 0 auto;
}

#app-kinder-season .ks-order-slot {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
    aspect-ratio: 3 / 4;
    min-height: 92px;
    border: 3px dashed var(--bs-border-color);
    border-radius: 16px;
    background: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
}

#app-kinder-season .ks-order-slot.filled {
    border-style: solid;
    border-color: var(--bs-primary);
    background: var(--bs-primary-bg-subtle);
    animation: ks-pop 0.4s ease;
}

#app-kinder-season .ks-slot-num {
    position: absolute;
    top: 4px;
    left: 8px;
    font-size: 0.8rem;
    font-weight: 900;
    color: var(--bs-secondary-color);
}
#app-kinder-season .ks-order-slot.filled .ks-slot-num { color: var(--kids-accent-text, var(--bs-primary)); }

#app-kinder-season .ks-order-pool {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.6rem;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

#app-kinder-season .ks-order-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    aspect-ratio: 3 / 4;
    min-height: 92px;
    border: 3px solid var(--bs-border-color);
    border-radius: 16px;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.12s ease, border-color 0.12s ease;
}

#app-kinder-season .ks-order-card:active { transform: scale(0.93); }
#app-kinder-season .ks-order-card.ks-miss { animation: ks-wobble 0.45s ease; }
#app-kinder-season .ks-order-card.ks-used {
    opacity: 0.3;
    pointer-events: none;
    filter: grayscale(0.5);
}

#app-kinder-season .ks-order-emoji { font-size: 2rem; line-height: 1.25; }
#app-kinder-season .ks-order-name { font-weight: 800; font-size: 0.72rem; text-align: center; }

/* モーション低減設定を尊重 */
@media (prefers-reduced-motion: reduce) {
    #app-kinder-season * {
        animation-duration: 0.001s !important;
        transition-duration: 0.001s !important;
    }
}
