/* title */
#title-wrapper {
    position: relative;
    z-index: 10;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* 上下中央 */
    align-items: center;
    /* 左右中央 */
    text-align: center;

    /* iPhoneのノッチやホームバーを避けるための余白 */
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    box-sizing: border-box;
}

#title-wrapper h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.5);
}

#title-wrapper p {
    font-size: 1.2rem;
    margin-bottom: 20px;
    padding: 0 10px;
}

/* Startボタンなどを押しやすく */
#start,
.btn {
    margin: 10px;
    padding: 12px 30px;
    font-size: 1.1rem;
    border-radius: 50px;
    /* 丸みをつけるとスマホっぽい */
}

/* キャラクター画像 */
#title-capko {
    margin: 20px auto;
    width: 100px;
}

#title-capko img {
    width: 100%;
    height: auto;
    border-radius: 30%;
    display: block;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

canvas {
    display: block;
}

/* ダイアログ（モーダル）のスタイル */
#story-dialog,
#torophy-dialog {
    border: none;
    border-radius: 20px;
    padding: 0;
    background: #000;
    max-width: 90vw;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

/* 背景（グレーアウト）の設定 */
#story-dialog::backdrop {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.dialog-content {
    position: relative;
    line-height: 0;
}

#storyAnimation {
    width: 100%;
    max-height: 80vh;
}

/* end of title */


/* ---- particle.js ---- */
#particles-js {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, #f59090, #fcd7a1, #fff9b1, #a5d4ad, #a3bce2, #a59aca, #cfa7cd);
    z-index: 1;
}

/* ---- stats.js ---- */
.count-particles {
    background: #000022;
    position: absolute;
    top: 48px;
    left: 0;
    width: 80px;
    color: #13E8E9;
    font-size: .8em;
    text-align: left;
    text-indent: 4px;
    line-height: 14px;
    padding-bottom: 2px;
    font-family: Helvetica, Arial, sans-serif;
    font-weight: bold;
}

.js-count-particles {
    font-size: 1.1em;
}

#stats,
.count-particles {
    -webkit-user-select: none;
    margin-top: 5px;
    margin-left: 5px;
}

#stats {
    border-radius: 3px 3px 0 0;
    overflow: hidden;
}

.count-particles {
    border-radius: 0 0 3px 3px;
}

/* --- Trophy Dialog スタイル定義 --- */

/* ダイアログ本体の枠（既存の#story-dialogと統一感を持たせつつ大きく設定） */
#trophy-dialog {
    border: none;
    border-radius: 20px;
    padding: 30px;
    background: #ffffff;
    /* 白ベースの綺麗な台紙 */
    width: 85%;
    max-width: 600px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    overflow-y: auto;
}

/* 背景（グレーアウト＆ボカシ）をストーリー用と統一 */
#trophy-dialog::backdrop {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

/* ダイアログ内のレイアウト調整 */
.trophy-dialog-container {
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* タイトルスタイル */
.trophy-dialog-title {
    font-size: 1.8rem;
    margin: 0 0 25px 0;
    text-align: center;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    color: #333;
}

/* リスト全体のコンテナ（要素が縦に並び、絶対に重ならない設定） */
.trophy-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
    /* カード同士の間隔 */
    margin-bottom: 25px;
}

/* 称号カードの共通定義（Flexboxで中身を縦並びにして、高さを自動追従） */
.trophy-card {
    padding: 15px 20px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    /* 称号名と条件の隙間 */
    text-align: left;
    width: 100%;
    height: auto;
}

/* 称号テキストの初期化（重なり防止の要） */
.trophy-card strong {
    font-size: 1.25rem;
    margin: 0;
    padding: 0;
    line-height: 1.2;
}

/* 条件テキストの初期化 */
.trophy-card p {
    font-size: 0.95rem;
    margin: 0 !important;
    /* style.cssの共通pマージンを打ち消す */
    padding: 0;
    line-height: 1.4;
    color: #555;
}

/* 各ランク固有の色・背景デザイン */
.trophy-card.master {
    background: rgba(255, 69, 0, 0.06);
    border-left: 6px solid #ff4500;
}

.trophy-card.master strong {
    color: #ff4500;
    font-size: 1.35rem;
}

.trophy-card.master p {
    font-weight: bold;
}

.trophy-card.excellent {
    background: rgba(255, 215, 0, 0.08);
    border-left: 6px solid #ffd700;
}

.trophy-card.excellent strong {
    color: #d4af37;
}

.trophy-card.good {
    background: rgba(112, 128, 144, 0.06);
    border-left: 6px solid #708090;
}

.trophy-card.good strong {
    color: #708090;
}

.trophy-card.rookie {
    background: rgba(205, 127, 50, 0.06);
    border-left: 6px solid #cd7f32;
}

.trophy-card.rookie strong {
    color: #cd7f32;
}

/* 閉じるボタンの配置調整 */
.trophy-close-wrapper {
    text-align: center;
    width: 100%;
}

.trophy-close-wrapper .close-button {
    padding: 10px 30px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    border-radius: 50px;
    border: 1px solid #ccc;
    background: #fff;
    transition: background 0.2s;
}

.trophy-close-wrapper .close-button:active {
    background: #eee;
}

/* --- 横画面（Landscape）用の設定 --- */
@media (orientation: landscape) {
    #title-wrapper {
        /* 横向きの時は左右に並べる */
        flex-direction: row;
        justify-content: space-around;
        align-items: center;
        padding: 0 10%;
        /* 左右に少し余裕を持たせる */
    }

    /* テキスト類（h1, p, ボタン）を左側にまとめるブロック */
    .title-content-group {
        text-align: left;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }

    #title-wrapper h1 {
        font-size: 2rem;
        /* 横画面は高さがないので少し小さく */
        margin-bottom: 5px;
    }

    #title-wrapper p {
        font-size: 1rem;
        margin-bottom: 10px;
    }

    /* 右側に配置するキャラクター */
    #title-capko {
        margin-top: 0;
        width: 30vh;
        max-width: 150px;
    }

    #select-wrapper {
        margin: 0;
        flex-direction: row;
        width: 100vw;
        height: 100dvh;
    }

    #select-header {
        width: 35%;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding-left: calc(env(safe-area-inset-left) + 20px);
    }

    #videoSelector {
        width: 65%;
        height: 100%;
        padding-right: calc(env(safe-area-inset-right) + 20px);
        padding-left: 10px;
        overflow-y: auto;
    }
}