/* ブラウザバー対策 dvh */
html, body { 
    margin: 0; padding: 0; width: 100%; height: 100dvh; 
    background: #000; overflow: hidden; font-family: sans-serif; 
}

/* 画面1: 上下左右中央 */
#init-overlay { 
position: fixed; inset: 0; display: flex; 
    justify-content: center; align-items: center; 
    background: #000;
    z-index: 500;
    color: #fff;
}
.centered-content { display: flex; flex-direction: column; align-items: center; text-align: center; }
.loader { width: 30px; height: 30px; border: 3px solid #333; border-top: 3px solid #fff; border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }

#start-btn {
    margin-top: 20px; padding: 15px 40px; background: #06c755; color: #fff; 
    border: none; border-radius: 50px; font-size: 18px; font-weight: bold; cursor: pointer;
    box-shadow: 0 5px 15px rgba(6,199,85,0.4); animation: pulse-btn 2s infinite;
}
@keyframes pulse-btn { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }

.ui-container { position: relative; width: 100%; max-width: 430px; height: 100dvh; margin: 0 auto; overflow: hidden; z-index: 10; }
.full-size-wrap { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 5; }

.shake-animation { animation: phone-shake 0.15s infinite; }
@keyframes phone-shake {
    0% { transform: translate(0,0); }
    25% { transform: translate(1.5px, 1.5px); }
    50% { transform: translate(0, 2px); }
    75% { transform: translate(-1.5px, 1.5px); }
    100% { transform: translate(0,0); }
}

#call-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 3; display: none; }
.ui-bg { position: absolute; inset: 0; background-size: cover; background-position: center; filter: blur(5px) brightness(0.8); transform: scale(1.1); }
.ui-overlay { position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.7) 100%); }

.content-wrapper { position: relative; height: 100%; display: flex; flex-direction: column; align-items: center; padding: 10dvh 0 0; box-sizing: border-box; color: #fff; }
.caller-profile { display: flex; flex-direction: column; align-items: center; text-align: center; margin-top: 5dvh; }
.icon-wrap { width: 120px; height: 120px; border-radius: 50%; overflow: hidden; border: 1.5px solid rgba(255,255,255,0.3); margin-bottom: 15px; }
.main-icon { width: 100%; height: 100%; object-fit: cover; }
.caller-name { font-size: 28px; margin: 0; }

.small-caller-icon { position: absolute; top: 20px; left: 20px; width: 85px; height: 85px; border-radius: 10px; overflow: hidden; border: 1px solid rgba(255,255,255,0.4); z-index: 15; }
.small-caller-icon img { width: 100%; height: 100%; object-fit: cover; }

.action-container { width: 100%; height: 140px; position: absolute; bottom: 8dvh; left: 0; display: flex; justify-content: center; align-items: center; z-index: 110; }
.call-actions { width: 100%; display: flex; justify-content: space-around; align-items: flex-start; }
.call-actions.centered { justify-content: center !important; }

.action-item { display: flex; flex-direction: column; align-items: center; width: 100px; cursor: pointer; }
.action-label { margin-top: 10px; font-size: 14px; color: #fff; }
.icon-circle { width: 70px; height: 70px; border-radius: 50%; display: flex; justify-content: center; align-items: center; }
.icon-circle svg { width: 32px; height: 32px; fill: #fff; }
.decline-bg { background-color: #ff3b30; }
.accept-bg { background-color: #34c759; }

#transition-black { position: absolute; inset: 0; background: #000; z-index: 20; }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.8); display: flex; justify-content: center; align-items: center; z-index: 1000; padding: 20px; }
.modal-card { background: #fff; width: 100%; max-width: 340px; border-radius: 20px; padding: 25px; text-align: center; color: #333; }
.app-header { display: flex; align-items: center; text-align: left; margin-bottom: 15px; }
.app-icon-main { width: 65px; height: 65px; border-radius: 14px; margin-right: 12px; object-fit: cover; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.app-title-area { display: flex; flex-direction: column; justify-content: center; }
.app-title-area h3 { font-size: 16px; margin: 0 0 2px 0; font-weight: bold; line-height: 1.2; }
.app-subtitle { font-size: 11px; color: #888; margin: 0 0 4px 0; line-height: 1.2; }
.rating { display: flex; align-items: center; margin-top: 0; }
.stars { color: #ffcc00 !important; font-size: 14px; letter-spacing: -1px; text-shadow: 0 0 1px rgba(0,0,0,0.1); }
.rating-num { font-size: 11px; color: #aaa; margin-left: 5px; }
.modal-body { text-align: left; font-size: 13px; color: #444; border-top: 1px solid #eee; padding-top: 12px; margin-bottom: 20px; line-height: 1.5; }
.install-btn { display: block; background: #007aff; color: #fff; text-decoration: none; padding: 14px; border-radius: 10px; font-weight: bold; }
.close-text { background: none; border: none; color: #999; margin-top: 15px; font-size: 12px; }

.hidden { display: none !important; }

/* 修正点：着信画面（screen）をあらかじめ裏側で描画しておく */
#incoming-call-screen.hidden {
    display: block !important; 
    opacity: 0;               
    pointer-events: none;     
    position: fixed;
    top: -9999px; /* 画面外へ配置しつつレンダリングを維持 */
}

.dot-typing { display: flex; justify-content: center; margin-top: 15px; }
.dot-typing span { width: 5px; height: 5px; margin: 0 3px; background-color: #34c759; border-radius: 50%; animation: dot-jump 1.4s infinite; }
@keyframes dot-jump { 0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; } 40% { transform: scale(1.1); opacity: 1; } }
.pulse-animation { animation: p-pulse 1.5s infinite; }
@keyframes p-pulse { 0% { box-shadow: 0 0 0 0 rgba(52,199,89,0.7); } 70% { box-shadow: 0 0 0 20px rgba(52,199,89,0); } 100% { box-shadow: 0 0 0 0 rgba(52,199,89,0); } }

#push-notification {
    position: absolute;
    top: 20px;
    width: 90%;
    max-width: 380px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    z-index: 250;
    cursor: pointer;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.5s;
}
.notification-hidden { transform: translateY(-150%); opacity: 0; }
.notification-show { transform: translateY(0); opacity: 1; }
.noti-icon { width: 40px; height: 40px; border-radius: 10px; overflow: hidden; margin-right: 12px; }
.noti-icon img { width: 100%; height: 100%; object-fit: cover; }
.noti-content { flex: 1; color: #333; }
.noti-header { display: flex; justify-content: space-between; margin-bottom: 2px; }
.noti-app-name { font-size: 11px; color: #666; font-weight: bold; }
.noti-time { font-size: 11px; color: #999; }
.noti-msg { font-size: 13px; margin: 0; line-height: 1.3; }
.noti-msg strong { color: #000; }

#init-overlay {
    background: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6)), url('bg.png') no-repeat center center;
    background-size: cover;
    z-index: 500 !important;
}