/* =============================================================
   entrance_custom.css
   /debug/profile-test 専用の検証スタイル。
   静的配信（vite/sass を通さない）。直接編集してリロードで反映。
   ============================================================= */

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: #fff5f9;
    font-family: "Hiragino Sans", "ヒラギノ角ゴ ProN W3", "Yu Gothic", "メイリオ", sans-serif;
    color: #333;
}

#profile-test-app .character {
    max-width: 1200px;
    margin: 24px auto;
    padding: 0 16px;
}

#profile-test-app .character h2 {
    text-align: center;
    margin: 0 0 16px;
}

#profile-test-app .character h2 img {
    max-width: 90%;
    height: auto;
    display: inline-block;
}

/* ---------- メインビジュアル ---------- */
.chara_main {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10; /* 背景 (3200x2000) と同じ */
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
}

.chara_main .chara_bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.chara_main .chara_standing {
    position: absolute;
    /* 立ち絵PNGはキャラが画像の中心にあるので、画像自体を左に大きくずらす */
    left: 0;
    bottom: 0;
    height: 100%;
    width: auto;
    transform: translateX(7%); /* キャラ位置の左右調整 */
    object-fit: contain;
    z-index: 2;
    pointer-events: none;
    /* 右端を斜めにカット（必要なければこの行ごと削除） */
    clip-path: polygon(0 0, 100% 0, calc(100% - 60px) 100%, 0 100%);
}

/* 白シルエット：本体の真下に同じ画像を重ね、透過していない部分を白塗り */
/* z-index 順：bg(0) → silhouette(1) → standing(2) */
.chara_main .chara_silhouette {
    /* brightness(0) で全ピクセルを黒に → invert(1) で白に。透過は維持される。blur で柔らかく */
    filter: brightness(0) invert(1) blur(4px);
    z-index: 1;
    opacity: 0.9;
    /* ハロ風に少しだけ大きく */
    transform: translate(6%, -1%) scale(1.01);
}

/* ---------- オーバーレイ：名前ボックス・属性・bwh ---------- */
.chara_overlay {
    position: absolute;
    z-index: 3;
    inset: 0;
    pointer-events: none;
}

.chara_name_box {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: #f085b3;
    color: #fff;
    padding: 0.4em 1.2em 0.4em 1.6em;
    border-radius: 9999px 0 0 9999px;
    font-size: clamp(28px, 4.2vw, 56px);
    font-weight: 800;
    letter-spacing: 0.05em;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.08);
    box-shadow: 0 6px 16px rgba(236, 91, 154, 0.35);
    min-width: 280px;
    text-align: center;
}

.chara_meta {
    position: absolute;
    right: 6%;
    top: calc(50% + clamp(40px, 6vw, 80px));
    color: #f085b3;
    font-size: clamp(18px, 2.4vw, 32px);
    font-weight: 800;
    /* 白フチを強めに（縁取り風） */
    text-shadow:
        2px 2px 0 #fff,  -2px 2px 0 #fff,
        2px -2px 0 #fff, -2px -2px 0 #fff,
        0 3px 0 #fff,    3px 0 0 #fff,
        0 -3px 0 #fff,  -3px 0 0 #fff,
        0 0 12px rgba(255, 255, 255, 0.9);
    white-space: nowrap;
}

.chara_meta .sep {
    display: inline-block;
    width: 1em;
}

.chara_dots {
    position: absolute;
    right: 6%;
    top: calc(50% + clamp(75px, 10vw, 130px));
    width: 40%;
    height: 6px;
    background-image: radial-gradient(circle, #f085b3 50%, transparent 50%);
    background-size: 14px 6px;
    background-repeat: repeat-x;
}

.chara_bwh {
    position: absolute;
    right: 6%;
    top: calc(50% + clamp(90px, 12vw, 150px));
    color: #f085b3;
    font-size: clamp(20px, 2.6vw, 36px);
    font-weight: 800;
    /* 白フチを強めに（縁取り風） */
    text-shadow:
        2px 2px 0 #fff,  -2px 2px 0 #fff,
        2px -2px 0 #fff, -2px -2px 0 #fff,
        0 3px 0 #fff,    3px 0 0 #fff,
        0 -3px 0 #fff,  -3px 0 0 #fff,
        0 0 12px rgba(255, 255, 255, 0.9);
    white-space: nowrap;
}

/* ---------- 下のサムネリスト ---------- */
.chara_select_grid {
    margin-top: 18px;
    display: flex;
    flex-wrap: wrap;
    /* gap = 視覚 5px + 外側リング 5px×2 = 15px */
    gap: 15px;
    /* 外側リング(box-shadow 5px) が画像幅をはみ出さないように両端を内側へ 5px */
    padding: 5px;
}

.chara_select_grid > span {
    /* 10列レイアウト：(100% - gap×9) / 10 */
    flex: 0 0 calc((100% - 135px) / 10);
    position: relative;
    cursor: pointer;
    transition: transform 0.2s, filter 0.2s;
    aspect-ratio: 1 / 1;
}

.chara_select_grid > span img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    /* 二重リング：内側ボーダー + 白ギャップ + 外側ボーダー（白部分を opacity 0.7 に） */
    border: 3px solid #a8c5e0;
    box-shadow:
        0 0 0 2px rgba(255, 255, 255, 0.7),  /* 白ギャップ */
        0 0 0 5px #a8c5e0;                    /* 外側リング */
    background: rgba(255, 255, 255, 0.7);
    transition: border-color 0.2s, box-shadow 0.2s, opacity 0.2s, filter 0.2s;
}

.chara_select_grid > span:hover img {
    opacity: 0.9;
    filter: brightness(1.05);
}

.chara_select_grid > span.selected img {
    border-color: #f085b3;
    box-shadow:
        0 0 0 2px rgba(255, 255, 255, 0.7),
        0 0 0 5px #f085b3;
}

.chara_select_grid > span .new-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ff3b3b;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    font-style: normal;
    padding: 2px 6px;
    border-radius: 999px;
    line-height: 1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    z-index: 1;
}

/* ---------- レスポンシブ：~768px ---------- */
@media (max-width: 768px) {
    .chara_select_grid > span {
        /* 5列レイアウト：(100% - gap×4) / 5 */
        flex: 0 0 calc((100% - 60px) / 5);
    }

    .chara_name_box {
        font-size: 24px;
        min-width: 0;
    }

    .chara_meta,
    .chara_bwh {
        font-size: 14px;
    }
}

/* ---------- レスポンシブ：~500px（スマホ縦） ---------- */
/* オーバーレイ全体を上下中央寄せ。右寄せはそのまま維持 */
@media (max-width: 500px) {
    .chara_overlay {
        display: flex;
        flex-direction: column;
        justify-content: center; /* 縦中央 */
        align-items: flex-end;   /* 右寄せ維持 */
        gap: 6px;
        padding-right: 6%;       /* PC 時の right: 6% に合わせる */
    }

    .chara_overlay .chara_name_box,
    .chara_overlay .chara_meta,
    .chara_overlay .chara_dots,
    .chara_overlay .chara_bwh {
        position: static;
        right: auto;
        top: auto;
        transform: none;
    }

    .chara_overlay .chara_name_box {
        /* 右側だけ丸めの形は PC と同じく維持 */
        font-size: 22px;
        padding: 0.3em 1em 0.3em 1.4em;
        margin-right: -6%;  /* オーバーレイの padding を打ち消し画面右端まで伸ばす */
    }

    .chara_overlay .chara_dots {
        width: 60%;
    }
}
