/* ============================================================
   体育アプリ ランチャー v1.5.1
   同一ページ内で複数の体育アプリを切り替えるための軽量ラッパー。
   既存アプリ(pe-record-carousel / gymnastics-abc-evaluation)には
   一切手を加えず、表示/非表示の切り替えだけを行う。

   修正: 選択画面を「カテゴリ色帯の3段レーン」デザインに変更。
   陸上運動・水泳運動・器械運動を色分けされた横帯（レーン）で表現。
   ============================================================ */

.pe-launcher-root {
    position: relative;
    font-family: "BIZ UDGothic", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
    box-sizing: border-box;
}

.pe-launcher-root *,
.pe-launcher-root *::before,
.pe-launcher-root *::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

.pe-launcher-root button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

/* ============ 表示/非表示ユーティリティ ============ */
.pe-launcher-root .pe-launcher-hidden {
    display: none !important;
}

/* ============ 選択画面（縦スクロール無し） ============ */
.pe-launcher-picker {
    position: fixed;
    inset: 0;
    z-index: 999998;
    background: linear-gradient(160deg, #f4f6f9 0%, #e9edf4 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow: hidden;
}

.pe-launcher-card {
    width: 100%;
    max-width: 980px;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    text-align: center;
}

.pe-launcher-brand {
    flex-shrink: 0;
    font-size: 19px;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: #1e3a5f;
    margin-bottom: 10px;
}

/* --- カテゴリ色帯のレーン(案C) --- */
.pe-launcher-lanes {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pe-launcher-lane {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: stretch;
    gap: 12px;
    background: var(--cat-bg);
    border-radius: 16px;
    padding: 10px 14px;
}

.pe-launcher-lane-label {
    writing-mode: vertical-rl;
    text-orientation: upright;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    background: var(--cat);
    border-radius: 10px;
    padding: 8px 5px;
    flex-shrink: 0;
    letter-spacing: 0.2em;
}

.pe-launcher-lane-tiles {
    flex: 1;
    display: flex;
    gap: 12px;
}

/* --- 種目タイル --- */
.pe-launcher-tile-sport {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: #fff;
    border: 2.5px solid transparent;
    border-radius: 14px;
    padding: 6px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(30, 58, 95, 0.08);
    transition: border-color 0.12s ease, transform 0.1s ease;
}

.pe-launcher-tile-sport:hover {
    border-color: var(--cat);
}

.pe-launcher-tile-sport:active {
    transform: scale(0.97);
}

.pe-launcher-tile-sport .pe-launcher-tile-icon {
    width: auto;
    height: clamp(50px, 11vh, 130px);
    max-width: 85%;
    flex-shrink: 1;
    object-fit: contain;
}

.pe-launcher-tile-sport .pe-launcher-tile-title {
    font-size: clamp(12px, 1.6vw, 15px);
    font-weight: 800;
    color: #1e3a5f;
    line-height: 1.3;
    flex-shrink: 0;
}

.pe-launcher-empty {
    padding: 40px 20px;
    color: #6b7a8d;
    font-size: 14px;
    font-weight: 700;
}

/* ============ 下部ユーティリティバー ============ */
.pe-launcher-utility-bar {
    flex-shrink: 0;
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 10px;
    font-size: 12px;
}

.pe-launcher-utility-link {
    display: inline-flex;
    align-items: center;
    color: #1e3a5f;
    font-weight: 800;
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 8px;
    transition: background 0.12s;
}

.pe-launcher-utility-link:hover {
    background: #eef1f6;
}

.pe-launcher-utility-sep {
    width: 1px;
    height: 16px;
    background: #d7dde6;
}

.pe-launcher-utility-label {
    color: #6b7a8d;
    font-weight: 700;
}

.pe-launcher-reset-btn {
    background: #fff;
    color: #b04040;
    border: 2px solid #ecd3d3;
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 700;
    transition: border-color 0.12s, background 0.12s;
}

.pe-launcher-reset-btn:hover {
    border-color: #b04040;
    background: #fff5f5;
}

.pe-launcher-reset-btn:active {
    transform: scale(0.96);
}

.pe-launcher-reset-message {
    font-size: 12px;
    font-weight: 700;
    color: #1e3a5f;
}

/* ============ アプリ表示中の「切り替える」ボタン ============ */
/* 左上だと各アプリ自身のヘッダータイトルと重なるため、
   両アプリのツールバー(📋⚙️)が無い左下に配置 */
.pe-launcher-switch-btn {
    position: fixed;
    left: 14px;
    bottom: 14px;
    z-index: 1000000;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #1e3a5f;
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    padding: 9px 16px 9px 12px;
    border-radius: 20px;
    box-shadow: 0 3px 12px rgba(30, 58, 95, 0.35);
    transition: transform 0.12s ease, background 0.12s ease;
}

.pe-launcher-switch-btn:hover {
    background: #27496f;
}

.pe-launcher-switch-btn:active {
    transform: scale(0.96);
}

/* ============ アプリ格納スロット ============ */
.pe-launcher-app-slot {
    position: relative;
}

/* ============ レスポンシブ ============ */
@media (max-width: 720px) {
    .pe-launcher-lanes {
        overflow-y: auto;
    }

    .pe-launcher-lane {
        flex-direction: column;
        flex: none;
    }

    .pe-launcher-lane-label {
        writing-mode: horizontal-tb;
        padding: 4px 10px;
        align-self: flex-start;
    }

    .pe-launcher-lane-tiles {
        flex-wrap: wrap;
    }

    .pe-launcher-tile-sport {
        flex: 1 1 100px;
    }

    .pe-launcher-picker {
        overflow-y: auto;
        align-items: flex-start;
        padding-top: 24px;
    }
}

@media (max-width: 480px) {
    .pe-launcher-brand {
        font-size: 17px;
    }

    .pe-launcher-switch-btn {
        left: 10px;
        bottom: 10px;
        font-size: 12px;
        padding: 8px 14px 8px 10px;
    }
}

@media (max-height: 560px) {
    .pe-launcher-tile-sport .pe-launcher-tile-icon {
        height: clamp(34px, 9vh, 60px);
    }

    .pe-launcher-tile-sport .pe-launcher-tile-title {
        font-size: 11px;
    }

    .pe-launcher-brand {
        font-size: 15px;
        margin-bottom: 6px;
    }

    .pe-launcher-lane-label {
        font-size: 11px;
        padding: 6px 4px;
    }
}
