/* style.css */

:root {
    --primary-color: #ffb6c1; /* Light Pink */
    --secondary-color: #ff9aa2; /* Coral Pink */
    --accent-color: #ff7b8c; /* Hot Pink */
    --text-color: #333333;
    --light-text-color: #666666;
    --background-light: #fdfdfd;
    --background-dark: #f0f0f0;
    --border-color: #e0e0e0;
    --deep-rose: #e62e5c; /* にぽちゃんカラー */
    --gradient-pink: linear-gradient(135deg, #ffc0cb, #ff7b8c);
    --header-height: 80px; 
    --nav-height: 75px;
    
    /* iPhoneのノッチ対策用変数 */
    --safe-top: env(safe-area-inset-top, 20px);
    --safe-bottom: env(safe-area-inset-bottom, 20px);
}

/* ============================ */
/* 🛡️ 機能制限 */
/* ============================ */
body {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    /* バウンススクロール防止 */
    overscroll-behavior-y: none;
}
img {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    pointer-events: auto; 
    
    /* 🔥【重要】スマホでの長押し（コンテキストメニュー）を無効化 */
    -webkit-touch-callout: none;
}

/* ============================ */
/* 📱 疑似スマホフレーム & レイアウト */
/* ============================ */
html, body {
    height: 100%; /* 全画面確保 */
    overflow: hidden; /* 二重スクロール防止 */
}

body {
    font-family: 'M PLUS Rounded 1c', sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f0f2f5;
    color: var(--text-color);
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app-container {
    /* PC表示のデフォルト（中央浮き） */
    width: 100%;
    max-width: 400px;
    height: 90vh; /* PCでは少し浮かせる */
    max-height: 800px;
    background-color: white;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
    border-radius: 30px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative; 
}

/* 📱 スマホ用レスポンシブ対応 */
@media (max-width: 480px) {
    body {
        background-color: white; /* 背景をアプリと一体化 */
    }
    #app-container {
        width: 100%;
        max-width: 100%;
        border-radius: 0; /* 角丸をなくす */
        box-shadow: none; /* 影を消す */
        
        /* 🔥 Safariのアドレスバー対策: dvhを使う */
        height: 100dvh; 
        max-height: none;

        /* 🔥 ノッチとホームバーの回避 (paddingで内側に押し込む) */
        padding-top: var(--safe-top); 
        padding-bottom: var(--safe-bottom);
        box-sizing: border-box; /* paddingを含めたサイズ計算にする */
    }
    
    /* ヘッダー位置の微調整：少し上に余裕を持たせる */
    header {
        margin-top: 5px; 
    }
}

/* 🎨 おしゃれなスクロールバー */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(230, 46, 92, 0.3); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(230, 46, 92, 0.5); }


/* ============================ */
/* ローディング画面 */
/* ============================ */
#loading-overlay {
    position: fixed;
    top: 0; left: 0; 
    width: 100%; height: 100%; 
    background-color: #ffedf0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10001;
    opacity: 1;
    transition: opacity 0.6s ease-out;
    border-radius: 30px; 
}
@media (max-width: 480px) {
    #loading-overlay { border-radius: 0; }
}

#loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}
.loading-content { text-align: center; transform: translateY(-20px); }
.loading-icon {
    width: 100px; height: 100px; border-radius: 50%; object-fit: cover;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    animation: pulse 1.5s infinite ease-in-out;
}
.loading-text {
    font-size: 18px; font-weight: 700; color: var(--deep-rose);
    margin-top: 20px; animation: fadeInOut 2s infinite ease-in-out;
}
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }
@keyframes fadeInOut { 0%, 100% { opacity: 0.7; } 50% { opacity: 1; } }


/* ============================ */
/* ヘッダー */
/* ============================ */
header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 15px; height: var(--header-height);
    background-color: white; border-bottom: 1px solid var(--border-color);
    box-sizing: border-box; flex-shrink: 0; z-index: 100; position: relative;
}

.header-left { display: flex; align-items: center; gap: 12px; flex: 1; }

.avatar-container {
    width: 50px; height: 50px; border-radius: 50%; overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); flex-shrink: 0; position: relative; border: 2px solid white; z-index: 5;
}
.avatar-container.clickable { cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; }
.avatar-container.clickable:hover { transform: scale(1.05); box-shadow: 0 4px 10px rgba(230, 46, 92, 0.3); }
.header-avatar { width: 100%; height: 100%; object-fit: cover; }
.click-hint-ring {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    border-radius: 50%; border: 2px solid var(--deep-rose); opacity: 0; animation: ripple 2s infinite;
}
@keyframes ripple { 0% { transform: scale(1); opacity: 0.6; } 100% { transform: scale(1.4); opacity: 0; } }

.header-info-col { display: flex; flex-direction: column; justify-content: center; gap: 4px; flex: 1; }
.name-area-row { position: relative; height: 18px; }

.hint-bubble {
    background: var(--deep-rose); color: white; font-size: 10px; padding: 3px 8px; border-radius: 6px;
    position: absolute; top: -5px; left: 0; line-height: 1.2; white-space: nowrap;
    animation: popBubble 3s infinite ease-in-out; box-shadow: 0 2px 5px rgba(230, 46, 92, 0.3);
}
.hint-bubble::after {
    content: ''; position: absolute; left: -4px; top: 50%; transform: translateY(-50%);
    border-width: 4px 4px 4px 0; border-style: solid; border-color: transparent var(--deep-rose) transparent transparent;
}
@keyframes popBubble { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

.status-row { display: flex; align-items: center; gap: 8px; }
.char-name { font-size: 14px; font-weight: 800; color: var(--text-color); line-height: 1; }

.status-col { display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.level-badge { color: var(--deep-rose); font-size: 9px; font-weight: 700; line-height: 1; }
.level-badge span { font-size: 11px; }

.exp-track {
    width: 100px; height: 6px; background-color: var(--background-dark);
    border-radius: 3px; overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}
.exp-fill {
    height: 100%; background: linear-gradient(90deg, #ff9a9e, #fecfef);
    width: 20%; border-radius: 3px; transition: width 0.3s ease;
}

.header-right {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; font-weight: 600; color: var(--light-text-color);
}
.header-right .signal, .header-right .battery { font-size: 13px; }
#current-time { font-weight: 700; font-size: 13px; color: var(--text-color); }
.live-badge {
    background-color: #ff4141; color: white; font-size: 9px; padding: 2px 6px; border-radius: 4px;
    font-weight: 700; animation: blink 1.5s infinite;
}

/* ============================ */
/* サイドバー */
/* ============================ */
#sidebar-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.2); z-index: 1000;
    opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(4px);
}
#sidebar-overlay.active { opacity: 1; visibility: visible; }

#app-sidebar {
    position: absolute; top: 0; left: 0; width: 280px; height: 100%;
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%);
    z-index: 1001; transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 10px 0 30px rgba(0,0,0,0.1); display: flex; flex-direction: column;
    border-right: 1px solid rgba(255,255,255,0.3);
}
#app-sidebar.active { transform: translateX(0); }

.sidebar-header { padding: 30px 20px 20px; display: flex; justify-content: space-between; align-items: center; background: transparent; }
.sidebar-title {
    font-size: 26px; font-weight: 900; background: var(--gradient-pink);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; letter-spacing: 1px;
}
.sidebar-close-btn {
    background: rgba(255,255,255,0.5); border: 1px solid rgba(255,255,255,0.8); color: var(--light-text-color);
    width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
    display: flex; justify-content: center; align-items: center; transition: all 0.2s; box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.sidebar-close-btn:hover { background: white; color: var(--deep-rose); transform: rotate(90deg); }

.sidebar-menu { list-style: none; padding: 10px 0; margin: 0; flex: 1; overflow-y: auto; }
.menu-label { padding: 15px 25px 5px; font-size: 10px; font-weight: 800; color: #999; text-transform: uppercase; letter-spacing: 1.5px; }
.sidebar-link {
    display: flex; align-items: center; padding: 14px 25px; text-decoration: none; color: var(--text-color);
    font-weight: 700; font-size: 15px; transition: all 0.2s; position: relative; border-radius: 0 25px 25px 0; margin-right: 10px;
}
.sidebar-link:hover {
    background: linear-gradient(90deg, rgba(255, 182, 193, 0.3) 0%, rgba(255,255,255,0) 100%);
    color: var(--deep-rose); padding-left: 35px;
}
.sidebar-link::before {
    content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    height: 60%; width: 4px; background: var(--deep-rose); opacity: 0; transition: opacity 0.2s; border-radius: 0 4px 4px 0;
}
.sidebar-link:hover::before { opacity: 1; }
.sidebar-link .icon-box {
    width: 24px; font-size: 18px; margin-right: 15px; text-align: center; color: #bbb;
    transition: color 0.2s; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.05));
}
.sidebar-link:hover .icon-box { color: var(--deep-rose); }
.sidebar-footer { padding: 20px; text-align: center; font-size: 11px; color: #bbb; background: rgba(255,255,255,0.3); }

.youtube-color { color: #ff0000 !important; }
.twitch-color { color: #9146ff !important; }
.bilibili-color { color: #00a1d6 !important; }
.booth-color { color: #fc4d50 !important; }
.fanbox-color { color: #f2c94c !important; }
.present-color { color: #ffb6c1 !important; }
.profile-color { color: #ffa07a !important; }
.game-color { color: #87ceeb !important; }
.movie-color { color: #9b59b6 !important; }
.dev-color { color: #2ecc71 !important; }

/* ============================ */
/* コンテンツエリア & ページ */
/* ============================ */
main { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; position: relative; }
.page {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--background-light); display: none; flex-direction: column;
    opacity: 0; transition: opacity 0.3s ease-out;
}
.page.active { display: flex; opacity: 1; }

/* iframe表示用クラス */
.full-frame {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* 埋め込みゲーム用のコンテナ */
.game-embed-container {
    flex: 1;
    width: 100%;
    background-color: #d4f0dd;
    position: relative;
    overflow: hidden;
}
.game-frame {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}


/* ============================ */
/* プロフィールページ (Bento Grid) */
/* ============================ */
.profile-content {
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    padding-bottom: 50px;
}
.bento-card {
    background: white; border-radius: 20px; padding: 20px;
    box-shadow: 0 4px 15px rgba(230, 46, 92, 0.08);
    display: flex; flex-direction: column; transition: transform 0.2s;
}
.bento-card:hover { transform: translateY(-3px); }
.card-large { grid-column: span 2; }
.prof-avatar-area { text-align: center; background: linear-gradient(135deg, #ffc0cb 0%, #ff7b8c 100%); color: white; }
.prof-avatar { width: 100px; height: 100px; border-radius: 50%; border: 4px solid white; object-fit: cover; margin-bottom: 10px; background: white; }
.prof-name { font-size: 24px; font-weight: 900; margin: 0; }
.prof-role { font-size: 12px; opacity: 0.9; font-weight: 600; }
.info-label { font-size: 11px; font-weight: 700; color: #aaa; margin-bottom: 5px; text-transform: uppercase; }
.info-value { font-size: 15px; font-weight: 700; color: var(--text-color); }
.tags-container { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { background: #f0f2f5; color: var(--light-text-color); padding: 6px 12px; border-radius: 15px; font-size: 12px; font-weight: 700; }
.tag.love { background: #ffe4e8; color: var(--deep-rose); }
.bio-text { font-size: 13px; line-height: 1.6; color: var(--light-text-color); }

/* ============================ */
/* ナビゲーション */
/* ============================ */
.nav-bar {
    display: flex; justify-content: space-around; align-items: center;
    background-color: white; border-top: 1px solid var(--border-color);
    height: var(--nav-height); box-sizing: border-box; flex-shrink: 0; z-index: 100; position: relative;
    /* 下部のホームバー対策。コンテナ側のpadding-bottomで押し上げられるため、ここでは特にpadding不要 */
}
.nav-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: var(--light-text-color); font-size: 11px; font-weight: 700; gap: 3px;
    cursor: pointer; transition: color 0.2s ease; flex: 1;
}
.nav-item i { font-size: 22px; }
.nav-item.active { color: var(--deep-rose); }
.nav-item.center { position: relative; top: -15px; width: 70px; height: 70px; flex: none; }
.nav-item.center .center-btn {
    width: 60px; height: 60px; background: var(--gradient-pink); border-radius: 50%;
    display: flex; justify-content: center; align-items: center; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    border: 4px solid white; box-sizing: border-box;
}
.nav-item.center img { width: 45px; height: 45px; object-fit: contain; }
.nav-item.center .center-label { position: absolute; bottom: 0px; font-size: 11px; color: var(--light-text-color); }
.nav-item.center.active .center-label { color: var(--deep-rose); }

/* Home & Others */
#page-home { position: relative; background-color: var(--primary-color); overflow: hidden; }
.video-bg-container { position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; }
#room-bg { width: 110%; height: 100%; margin-left: -5%; object-fit: cover; }
.home-char-container {
    position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 80%; max-width: 400px; height: 80%; display: flex; justify-content: center; align-items: flex-end;
    padding-bottom: var(--nav-height); box-sizing: border-box;
}
#home-nipo {
    max-height: 100%; width: auto; object-fit: contain; position: absolute; bottom: 0; right: -100px;
    transform: translateY(30%); animation: slideInFromBottom 1.2s forwards; transition: none;
}
@keyframes slideInFromBottom { 0% {transform: translateY(30%);} 100% {transform: translateY(0);} }
.speech-bubble {
    position: absolute; top: 30%; left: 20%; transform: translateX(-50%) scale(0);
    padding: 8px 15px; background-color: white; border-radius: 20px; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    font-size: 14px; font-weight: 700; color: var(--text-color); white-space: nowrap; opacity: 0;
    transition: transform 0.3s ease-out, opacity 0.3s ease-out; transform-origin: bottom center; z-index: 10;
}
.speech-bubble.show { transform: translateX(-50%) scale(1); opacity: 1; }